mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Ott <alan@signal11.us>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Tony Cheneau <tony.cheneau@amnesiak.org>,
	linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] 6lowpan: Make a copy of skb's delivered to 6lowpan
Date: Fri, 31 Aug 2012 09:56:19 -0400	[thread overview]
Message-ID: <5040C283.7040809@signal11.us> (raw)
In-Reply-To: <1346396485.2586.307.camel@edumazet-glaptop>

On 08/31/2012 03:01 AM, Eric Dumazet wrote:
> On Wed, 2012-08-29 at 22:39 -0400, Alan Ott wrote:
>> Since lowpan_process_data() modifies the skb (by calling skb_pull()), we
>> need our own copy so that it doesn't affect the data received by other
>> protcols (in this case, af_ieee802154).
>>
>> Signed-off-by: Alan Ott <alan@signal11.us>
>> ---
>>  net/ieee802154/6lowpan.c |    9 ++++++++-
>>  1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
>> index 6a09522..ce33b02 100644
>> --- a/net/ieee802154/6lowpan.c
>> +++ b/net/ieee802154/6lowpan.c
>> @@ -1133,6 +1133,8 @@ static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[])
>>  static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
>>  	struct packet_type *pt, struct net_device *orig_dev)
>>  {
>> +	struct sk_buff *local_skb;
>> +
>>  	if (!netif_running(dev))
>>  		goto drop;
>>  
>> @@ -1144,7 +1146,12 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
>>  	case LOWPAN_DISPATCH_IPHC:	/* ipv6 datagram */
>>  	case LOWPAN_DISPATCH_FRAG1:	/* first fragment header */
>>  	case LOWPAN_DISPATCH_FRAGN:	/* next fragments headers */
>> -		lowpan_process_data(skb);
>> +		local_skb = skb_copy(skb, GFP_ATOMIC);
>> +		if (!local_skb)
>> +			goto drop;
>> +		lowpan_process_data(local_skb);
>> +
>> +		kfree_skb(skb);
>>  		break;
>>  	default:
>>  		break;
> Its not clear to me why skb_copy() is needed here.
>
> >From patch description, I would say skb_clone() would be enough (and
> faster) ?

You're probably right. I'll check it out. Thanks.

Alan.

  reply	other threads:[~2012-08-31 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30  2:38 [PATCH v2 0/2] 6lowpan fixes Alan Ott
2012-08-30  2:39 ` [PATCH v2 1/2] 6lowpan: Make a copy of skb's delivered to 6lowpan Alan Ott
2012-08-31  7:01   ` Eric Dumazet
2012-08-31 13:56     ` Alan Ott [this message]
2012-08-30  2:39 ` [PATCH v2 2/2] 6lowpan: handle NETDEV_UNREGISTER event Alan Ott
2012-09-01 15:57 ` [PATCH v3 0/2] 6lowpan fixes Alan Ott
2012-09-02  2:48   ` David Miller
2012-09-01 15:57 ` [PATCH v3 1/2] 6lowpan: Make a copy of skb's delivered to 6lowpan Alan Ott
2012-09-01 15:57 ` [PATCH v3 2/2] 6lowpan: handle NETDEV_UNREGISTER event Alan Ott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5040C283.7040809@signal11.us \
    --to=alan@signal11.us \
    --cc=alex.bluesman.smirnov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dbaryshkov@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-zigbee-devel@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=tony.cheneau@amnesiak.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®