Commit 47061bc4 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: skb_share_check() should use consume_skb()

In order to avoid false drop_monitor indications, we should
call consume_skb() if skb_clone() was successful.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc72d100
...@@ -846,12 +846,15 @@ static inline int skb_shared(const struct sk_buff *skb) ...@@ -846,12 +846,15 @@ static inline int skb_shared(const struct sk_buff *skb)
* *
* NULL is returned on a memory allocation failure. * NULL is returned on a memory allocation failure.
*/ */
static inline struct sk_buff *skb_share_check(struct sk_buff *skb, static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri)
gfp_t pri)
{ {
might_sleep_if(pri & __GFP_WAIT); might_sleep_if(pri & __GFP_WAIT);
if (skb_shared(skb)) { if (skb_shared(skb)) {
struct sk_buff *nskb = skb_clone(skb, pri); struct sk_buff *nskb = skb_clone(skb, pri);
if (likely(nskb))
consume_skb(skb);
else
kfree_skb(skb); kfree_skb(skb);
skb = nskb; skb = nskb;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment