Patchwork [1/3,-next] 6LoWPAN: use kfree_skb() instead of kfree()

login
register
mail settings
Submitter Dan Carpenter
Date Aug. 30, 2011, 1:45 p.m.
Message ID <20110830134552.GH3705@shale.localdomain>
Download mbox | patch
Permalink /patch/112306/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - Aug. 30, 2011, 1:45 p.m.
Use kfree_skb() to free sbk_buffs.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - Aug. 30, 2011, 2:40 p.m.
Le mardi 30 août 2011 à 16:45 +0300, Dan Carpenter a écrit :
> Use kfree_skb() to free sbk_buffs.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
> index cf304cc..8a9dbaa 100644
> --- a/net/ieee802154/6lowpan.c
> +++ b/net/ieee802154/6lowpan.c
> @@ -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);



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
alex.bluesman.smirnov@gmail.com - Sept. 1, 2011, 9:26 a.m.
Hi Dan, Eric,

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

With best regards,
Alexander


2011/8/30 Eric Dumazet <eric.dumazet@gmail.com>:
> Le mardi 30 août 2011 à 16:45 +0300, Dan Carpenter a écrit :
>> Use kfree_skb() to free sbk_buffs.
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
>>
>> diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
>> index cf304cc..8a9dbaa 100644
>> --- a/net/ieee802154/6lowpan.c
>> +++ b/net/ieee802154/6lowpan.c
>> @@ -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);
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Carpenter - Sept. 1, 2011, 3:04 p.m.
On Thu, Sep 01, 2011 at 01:26:02PM +0400, Alexander Smirnov wrote:
> 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Carpenter - Sept. 1, 2011, 3:06 p.m.
On Thu, Sep 01, 2011 at 06:04:25PM +0300, Dan Carpenter wrote:
> On Thu, Sep 01, 2011 at 01:26:02PM +0400, Alexander Smirnov wrote:
> > 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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Sept. 15, 2011, 7:42 p.m.
From: Dan Carpenter <error27@gmail.com>
Date: Tue, 30 Aug 2011 16:45:52 +0300

> Use kfree_skb() to free sbk_buffs.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index cf304cc..8a9dbaa 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -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;
 }