Message ID | 1375225875.10515.36.camel@edumazet-glaptop |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Tue, 30 Jul 2013 16:11:15 -0700 > From: Eric Dumazet <edumazet@google.com> > > 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> Applied, but personally I would have considered adding an else clause checking BUG_ON(skb->sk), or are you not so confident in your assertion? :-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2013-07-31 at 15:24 -0700, David Miller wrote: > Applied, but personally I would have considered adding an > else clause checking BUG_ON(skb->sk), or are you not so > confident in your assertion? :-) I considered this but this was adding a significant overhead, as this is an inline function. What about doing that for a limited time, say until 3.12 is released ? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Wed, 31 Jul 2013 15:44:51 -0700 > On Wed, 2013-07-31 at 15:24 -0700, David Miller wrote: > >> Applied, but personally I would have considered adding an >> else clause checking BUG_ON(skb->sk), or are you not so >> confident in your assertion? :-) > > I considered this but this was adding a significant overhead, as this > is an inline function. > > What about doing that for a limited time, say until 3.12 is released ? That sounds like a great idea. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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; + } } /**