[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALnjE+rJdddCLZ8+30u8yWPx8xJtRv-+XQgDX1CQvecgOHE5fg@mail.gmail.com>
Date: Thu, 24 Jan 2013 17:36:26 -0800
From: Pravin Shelar <pshelar@...ira.com>
To: Michał Mirosław <mirqus@...il.com>
Cc: netdev@...r.kernel.org, jesse@...ira.com, eric.dumazet@...il.com
Subject: Re: [PATCH 1/2] net: Add skb_unclone() helper function.
On Thu, Jan 24, 2013 at 5:21 PM, Michał Mirosław <mirqus@...il.com> wrote:
> 2013/1/24 Pravin B Shelar <pshelar@...ira.com>:
> [...]
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -798,6 +798,19 @@ static inline int skb_cloned(const struct sk_buff *skb)
>> }
>>
>> /**
>> + * skb_unclone - creates separate copy if skb is cloned.
>> + */
>> +static inline bool skb_unclone(struct sk_buff *skb, gfp_t pri)
>> +{
>> + might_sleep_if(pri & __GFP_WAIT);
>> +
>> + if (skb_cloned(skb))
>> + return pskb_expand_head(skb, 0, 0, pri);
>> +
>> + return 0;
>> +}
>
> This should return int. pskb_expand_head() returns 0 or -ENOMEM.
>
> [...]
>> diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
>> index ddee0a0..c1f00ef 100644
>> --- a/net/ipv4/xfrm4_mode_tunnel.c
>> +++ b/net/ipv4/xfrm4_mode_tunnel.c
>> @@ -142,8 +142,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
>> for_each_input_rcu(rcv_notify_handlers, handler)
>> handler->handler(skb);
>>
>> - if (skb_cloned(skb) &&
>> - (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
>> + if (skb_unclone(skb, GFP_ATOMIC))
>> goto out;
>
> And here return -ENOMEM is replaced with return -EINVAL because of this.
>
ok, I will change skb_unclone return to int.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists