skbuff: fix ftrace handling in skb_unshare
Subsystems (2)
PATCH 1/1 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.
--- include/linux/skbuff.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/skbuff.h +6 -1
@@ -1116,7 +1116,12 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,might_sleep_if (pri & __GFP_WAIT);if (skb_cloned (skb)) {struct sk_buff *nskb =skb_copy (skb, pri); -kfree_skb (skb);/* Free our shared copy */ + +/* Free our shared copy */ +if (likely (nskb)) +consume_skb (skb); +else +kfree_skb (skb); skb = nskb; }return skb;
Signature · 1 line
2.1.2
From: Alexander Aring <[email protected]>
Date: Fri, 10 Oct 2014 23:10:47 +0200
Quoted 8 lines
If the skb is not dropped afterwards we should run
consume_skbinsteadkfree_skb. Inside of functionskb_unsharewe do always akfree_skb, doesn't depend ifskb_copyfailed or was successful.This patch switch this behaviour like
skb_share_check, if allocation ofsk_bufffailed we usekfree_skbotherwiseconsume_skb.Signed-off-by Alexander Aring <[email protected]>
Applied, thanks.