From 768db3901820f355efb158c6913ecdb19bbfd9ed Mon Sep 17 00:00:00 2001 From: David Miller Date: Wed, 2 Dec 2009 16:01:04 -0800 Subject: [PATCH] net: Fix thinko in backport of skb destructor fix. As noticed by Oliver Hartkopp, the backport of the 'net: Partially allow skb destructors to be used on receive path' (2.6.30.y commit: 172570a224fe66d560c097e48fca15b620c76e72, upstream commit: d55d87fdff8252d0e2f7c28c2d443aee17e9d70f) was buggy. It should have added an skb_orphan() call to both skb_set_owner_w() and skb_set_owner_r(). Instead it added two calls to skb_set_owner_r(). This fixes it up. Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/sock.h b/include/net/sock.h index 9bc2c830b5a..cda38015fca 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1223,6 +1223,7 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) { + skb_orphan(skb); sock_hold(sk); skb->sk = sk; skb->destructor = sock_wfree; @@ -1231,7 +1232,6 @@ static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) { - skb_orphan(skb); skb_orphan(skb); skb->sk = sk; skb->destructor = sock_rfree; -- 2.34.1