Commit a3a116e0 authored by Hannes Frederic Sowa's avatar Hannes Frederic Sowa Committed by David S. Miller

af_unix: take receive queue lock while appending new skb

While possibly in future we don't necessarily need to use
sk_buff_head.lock this is a rather larger change, as it affects the
af_unix fd garbage collector, diag and socket cleanups. This is too much
for a stable patch.

For the time being grab sk_buff_head.lock without disabling bh and irqs,
so don't use locked skb_queue_tail.

Fixes: 869e7c62 ("net: af_unix: implement stream sendpage support")
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Reported-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b22b941b
...@@ -1813,8 +1813,11 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page, ...@@ -1813,8 +1813,11 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page,
skb->truesize += size; skb->truesize += size;
atomic_add(size, &sk->sk_wmem_alloc); atomic_add(size, &sk->sk_wmem_alloc);
if (newskb) if (newskb) {
spin_lock(&other->sk_receive_queue.lock);
__skb_queue_tail(&other->sk_receive_queue, newskb); __skb_queue_tail(&other->sk_receive_queue, newskb);
spin_unlock(&other->sk_receive_queue.lock);
}
unix_state_unlock(other); unix_state_unlock(other);
mutex_unlock(&unix_sk(other)->readlock); mutex_unlock(&unix_sk(other)->readlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment