diff options
author | Paolo Abeni <pabeni@redhat.com> | 2017-06-12 11:23:41 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-12 10:01:29 -0400 |
commit | 3889a803e1da9bd7cd10d6504bf281ee7e55dfd6 (patch) | |
tree | a02fdf7382352a186732bb51028ccebcdc2afde1 /net/core/datagram.c | |
parent | 78d6102256fe46fcd0c78798a9391cf1f112f117 (diff) | |
download | linux-stable-3889a803e1da9bd7cd10d6504bf281ee7e55dfd6.tar.gz linux-stable-3889a803e1da9bd7cd10d6504bf281ee7e55dfd6.tar.bz2 linux-stable-3889a803e1da9bd7cd10d6504bf281ee7e55dfd6.zip |
net: factor out a helper to decrement the skb refcount
The same code is replicated in 3 different places; move it to a
common helper.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/datagram.c')
-rw-r--r-- | net/core/datagram.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index bc46118486fe..e5311a7c70da 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -330,9 +330,7 @@ void __skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb, int len) { bool slow; - if (likely(atomic_read(&skb->users) == 1)) - smp_rmb(); - else if (likely(!atomic_dec_and_test(&skb->users))) { + if (!skb_unref(skb)) { sk_peek_offset_bwd(sk, len); return; } |