From: Eric Dumazet Date: Tue, 30 Jul 2013 23:11:15 +0000 (-0700) Subject: net: skb_orphan() changes X-Git-Tag: v3.12-rc1~132^2~412 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c34a761231b56dea4bd205cb9c29ffe37475d232;p=profile%2Fivi%2Fkernel-x86-ivi.git net: skb_orphan() changes It is illegal to set skb->sk without corresponding destructor. Its therefore safe for skb_orphan() to not clear skb->sk if skb->destructor is not set. Also avoid clearing skb->destructor if already NULL. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5afefa0..a95547a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1805,10 +1805,11 @@ static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len) */ static inline void skb_orphan(struct sk_buff *skb) { - if (skb->destructor) + if (skb->destructor) { skb->destructor(skb); - skb->destructor = NULL; - skb->sk = NULL; + skb->destructor = NULL; + skb->sk = NULL; + } } /**