diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-10 17:10:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-14 13:10:31 -0400 |
commit | 31eff81e94472ddb7549509bf4b6e93e1f6f7dc9 (patch) | |
tree | d9a63b8a16e7f8a2cc80a85011cf3f07d465af25 /include/linux/skbuff.h | |
parent | 2c2b2f0cb9388df8aa8b5036cf18060ac77e6d94 (diff) |
skbuff: fix ftrace handling in skb_unshare
If the skb is not dropped afterwards we should run consume_skb instead
kfree_skb. Inside of function skb_unshare we do always a kfree_skb,
doesn't depend if skb_copy failed or was successful.
This patch switch this behaviour like skb_share_check, if allocation of
sk_buff failed we use kfree_skb otherwise consume_skb.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 3ab0749d6875..a59d9343c25b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1203,7 +1203,12 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb, | |||
1203 | might_sleep_if(pri & __GFP_WAIT); | 1203 | might_sleep_if(pri & __GFP_WAIT); |
1204 | if (skb_cloned(skb)) { | 1204 | if (skb_cloned(skb)) { |
1205 | struct sk_buff *nskb = skb_copy(skb, pri); | 1205 | struct sk_buff *nskb = skb_copy(skb, pri); |
1206 | kfree_skb(skb); /* Free our shared copy */ | 1206 | |
1207 | /* Free our shared copy */ | ||
1208 | if (likely(nskb)) | ||
1209 | consume_skb(skb); | ||
1210 | else | ||
1211 | kfree_skb(skb); | ||
1207 | skb = nskb; | 1212 | skb = nskb; |
1208 | } | 1213 | } |
1209 | return skb; | 1214 | return skb; |