LLC: Avoid potential NULL dereference in net/llc/af_llc.c::llc_ui_accept() .
Subsystems (2)
PATCH 1/1 LLC: Avoid potential NULL dereference in net/llc/af_llc.c::llc_ui_accept() .
Since skb_dequeue() may return NULL we risk dereferencing a NULL pointer at
if (!skb->sk)
This patch avoids that by also testing for a NULL skb.
---
net/llc/af_llc.c +1 -1
@@ -620,7 +620,7 @@ static int llc_ui_accept(struct socket * llc_sk(sk)->laddr.lsap); skb =skb_dequeue (&sk->sk_receive_queue); rc = -EINVAL ; -if (!skb->sk) +if (!skb || !skb->sk) goto frees; rc =0 ; newsk = skb->sk;
David Miller
maintainerFrom: Jesper Juhl <[email protected]>
Date: Thu, 2 Nov 2006 01:21:53 +0100
Quoted 6 lines
Since
skb_dequeue()may return NULL we risk dereferencing a NULL pointer at
if (!skb->sk)
This patch avoids that by also testing for a NULL skb.Signed-off-by Jesper Juhl <[email protected]>
It can't return NULL in this context because we just checked skb_queue_empty() with the socket lock held and llc_wait_data() will return zero only if skb_queue_empty() is false.
I know it's hard for automated tools to see this, but it's not reasonable to put this extra check in there since it is superfluous due to the above mentioned invariants.
Quoted 10 lines · David Miller
From: Jesper Juhl <[email protected]>
Date: Thu, 2 Nov 2006 01:21:53 +0100Quoted 6 lines
Since
skb_dequeue()may return NULL we risk dereferencing a NULL pointer at
if (!skb->sk)
This patch avoids that by also testing for a NULL skb.Signed-off-by Jesper Juhl <[email protected]>
Quoted 8 lines
It can't return NULL in this context because we just checked
skb_queue_empty()with the socket lock held andllc_wait_data()will return zero only ifskb_queue_empty()is false.I know it's hard for automated tools to see this, but it's not reasonable to put this extra check in there since it is superfluous due to the above mentioned invariants.
Fair enough. Ignore the patch.
Thank you for the explanation.
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html