aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-07-30 16:11:15 -0700
committerDavid S. Miller <davem@davemloft.net>2013-07-31 15:24:08 -0700
commitc34a761231b56dea4bd205cb9c29ffe37475d232 (patch)
tree43f6880f06f781f2fa10ee54be32c426f9b58620 /include
parentnetem: Introduce skb_orphan_partial() helper (diff)
downloadlinux-dev-c34a761231b56dea4bd205cb9c29ffe37475d232.tar.xz
linux-dev-c34a761231b56dea4bd205cb9c29ffe37475d232.zip
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 <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/skbuff.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5afefa01a13c..a95547adff25 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;
+ }
}
/**