Skip to contentSkip to conversation

6LoWPAN: use kfree_skb() instead of kfree()

PATCH Applied Dan Carpenter 4 participants 6 messages Aug 30, 2011 – Sep 15, 2011 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 6LoWPAN: use kfree_skb() instead of kfree()

Use kfree_skb() to free sbk_buffs.

net/ieee802154/6lowpan.c +1 -1
index cf304cc..8a9dbaa 100644
@@ -674,7 +674,7 @@ lowpan_process_data(struct sk_buff *skb)
 							sizeof(hdr));
 	return lowpan_skb_deliver(skb, &hdr);
 drop:
-	kfree(skb);
+	kfree_skb(skb);
 	return -EINVAL;
 }
 
#1 lore raw
Quoted 9 lines · Dan Carpenter

Use kfree_skb() to free sbk_buffs.

net/ieee802154/6lowpan.c +0 -0
index cf304cc..8a9dbaa 100644

net/ieee802154/6lowpan.c lowpan_process_data(struct sk_buff *skb) · line 680

Quoted 8 lines
net/ieee802154/6lowpan.c +1 -1
@@ -674,7 +674,7 @@ lowpan_process_data(struct sk_buff *skb)
 							sizeof(hdr));
 	return lowpan_skb_deliver(skb, &hdr);
 drop:
-	kfree(skb);
+	kfree_skb(skb);
 	return -EINVAL;
 }
 

Another bug is the skb_copy() done in lowpan_skb_deliver()

1) No check of skb_copy() return

2.1) Use of GFP_KERNEL : Is it safe at this point ? Aren’t we in softirq ?

2.2) If GFP_KERNEL is safe, why do we later do :

	if (in_interrupt())
		stat = netif_rx(skb);
	else
		stat = netif_rx_ni(skb);
#2 lore raw

Hi Dan, Eric,

thank you a lot for the finds, that were my faults.

With best regards,
Alexander

2011/8/30 Eric Dumazet <[email protected]>:

Quoted 26 lines · Dan Carpenter
Quoted 11 lines

Use kfree_skb() to free sbk_buffs.

net/ieee802154/6lowpan.c +0 -0
index cf304cc..8a9dbaa 100644
@@ -674,7 +674,7 @@ lowpan_process_data(struct sk_buff *skb)
                                                       sizeof(hdr));
       return lowpan_skb_deliver(skb, &hdr);
Quoted 6 lines

 drop:
-     kfree(skb);
+     kfree_skb(skb);
      return -EINVAL;
 }

Another bug is the skb_copy() done in lowpan_skb_deliver()

1) No check of skb_copy() return

2.1) Use of GFP_KERNEL : Is it safe at this point ? Aren’t we in softirq ?

Quoted 10 lines

2.2) If GFP_KERNEL is safe, why do we later do :

       if (in_interrupt())
               stat = netif_rx(skb);
       else
               stat = netif_rx_ni(skb);

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 4 lines · Alexander Smirnov

Hi Dan, Eric,

thank you a lot for the finds, that were my faults.

So uh... You're going to send a patch to fix the things Eric mentioned, right?

regards,
dan carpenter

#4 lore raw
Quoted 9 lines · Dan Carpenter
Quoted 4 lines · Alexander Smirnov

Hi Dan, Eric,

thank you a lot for the finds, that were my faults.

So uh... You're going to send a patch to fix the things Eric mentioned, right?

Ah. You did already. I see that now. Sorry for the noise.

regards,
dan carpenter

A message that is not in the archive (sent off-list or not yet received): 20110830134552.GH3705-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org