Skip to contentSkip to conversation

NULL pointer bug in netpoll.c

PATCH Jan Kiszka 1 participant 1 message Mar 19, 2005 Networking

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi,

it seems that there is a gremlin sleeping in net/core/netpoll.c:find_skb(). Even if no more buffers are available through "skbs", "skb" is dereferenced anyway. The tiny patch should fix it.

Jan

net/core/netpoll.c renamed from net/core/netpoll.c.orig +4 -3
@@ -165,10 +165,11 @@ repeat:
 	if (!skb) {
 		spin_lock_irqsave(&skb_list_lock, flags);
 		skb = skbs;
-		if (skb)
+		if (skb) {
 			skbs = skb->next;
-		skb->next = NULL;
-		nr_skbs--;
+			skb->next = NULL;
+			nr_skbs--;
+		}
 		spin_unlock_irqrestore(&skb_list_lock, flags);
 	}