* [PATCH net] skbuff: fix ftrace handling in skb_unshare
@ 2014-10-10 21:10 Alexander Aring
2014-10-14 17:10 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2014-10-10 21:10 UTC (permalink / raw)
To: netdev; +Cc: kernel, Alexander Aring
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>
---
include/linux/skbuff.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index abde271..d150734 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -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;
--
2.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] skbuff: fix ftrace handling in skb_unshare
2014-10-10 21:10 [PATCH net] skbuff: fix ftrace handling in skb_unshare Alexander Aring
@ 2014-10-14 17:10 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-10-14 17:10 UTC (permalink / raw)
To: alex.aring; +Cc: netdev, kernel
From: Alexander Aring <alex.aring@gmail.com>
Date: Fri, 10 Oct 2014 23:10:47 +0200
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-14 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-10 21:10 [PATCH net] skbuff: fix ftrace handling in skb_unshare Alexander Aring
2014-10-14 17:10 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).