Message ID | 1272948225.2407.170.camel@edumazet-laptop |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Tue, 04 May 2010 06:43:45 +0200 > David, if I am not mistaken (not thea yet for me this early morning) the > tracer you mention is included in kfree_skb(), not in __kfree_skb() : ... > I only copied part of consume_skb() which doesnt call > trace_kfree_skb() : ... > So I believe my second patch is a bit better : We dont even lock the > socket in the (rare) case we should not orphan the skb ;) Right you are. > [PATCH net-next-2.6] net: skb_free_datagram_locked() fix I'll apply this, thanks! -- 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/net/core/datagram.c b/net/core/datagram.c index 95b851f..e009753 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -229,13 +229,18 @@ EXPORT_SYMBOL(skb_free_datagram); void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb) { + if (likely(atomic_read(&skb->users) == 1)) + smp_rmb(); + else if (likely(!atomic_dec_and_test(&skb->users))) + return; + lock_sock_bh(sk); skb_orphan(skb); sk_mem_reclaim_partial(sk); unlock_sock_bh(sk); - /* skb is now orphaned, might be freed outside of locked section */ - consume_skb(skb); + /* skb is now orphaned, can be freed outside of locked section */ + __kfree_skb(skb); } EXPORT_SYMBOL(skb_free_datagram_locked);