Skip to content

Commit 276bdb8

Browse files
miniplidavem330
authored andcommitted
dccp: check ccid before dereferencing
ccid_hc_rx_getsockopt() and ccid_hc_tx_getsockopt() might be called with a NULL ccid pointer leading to a NULL pointer dereference. This could lead to a privilege escalation if the attacker is able to map page 0 and prepare it with a fake ccid_ops pointer. Signed-off-by: Mathias Krause <[email protected]> Cc: Gerrit Renker <[email protected]> Cc: [email protected] Signed-off-by: David S. Miller <[email protected]>
1 parent 3592aae commit 276bdb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/dccp/ccid.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static inline int ccid_hc_rx_getsockopt(struct ccid *ccid, struct sock *sk,
246246
u32 __user *optval, int __user *optlen)
247247
{
248248
int rc = -ENOPROTOOPT;
249-
if (ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL)
249+
if (ccid != NULL && ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL)
250250
rc = ccid->ccid_ops->ccid_hc_rx_getsockopt(sk, optname, len,
251251
optval, optlen);
252252
return rc;
@@ -257,7 +257,7 @@ static inline int ccid_hc_tx_getsockopt(struct ccid *ccid, struct sock *sk,
257257
u32 __user *optval, int __user *optlen)
258258
{
259259
int rc = -ENOPROTOOPT;
260-
if (ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL)
260+
if (ccid != NULL && ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL)
261261
rc = ccid->ccid_ops->ccid_hc_tx_getsockopt(sk, optname, len,
262262
optval, optlen);
263263
return rc;

0 commit comments

Comments
 (0)