All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] LLC: Avoid potential NULL dereference in net/llc/af_llc.c::llc_ui_accept() .
@ 2006-11-02  0:21 Jesper Juhl
  2006-11-02  0:27 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2006-11-02  0:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jay Schulist, Arnaldo Carvalho de Melo, davem, Jesper Juhl

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 <jesper.juhl@gmail.com>
---

diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 2652ead..a3c885f 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -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;



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-02  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02  0:21 [PATCH] LLC: Avoid potential NULL dereference in net/llc/af_llc.c::llc_ui_accept() Jesper Juhl
2006-11-02  0:27 ` David Miller
2006-11-02  0:30   ` Jesper Juhl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.