Skip to content

Commit a3a116e

Browse files
strssndktndavem330
authored andcommitted
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: 869e7c6 ("net: af_unix: implement stream sendpage support") Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Reported-by: Eric Dumazet <edumazet@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b22b941 commit a3a116e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/unix/af_unix.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,8 +1813,11 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page,
18131813
skb->truesize += size;
18141814
atomic_add(size, &sk->sk_wmem_alloc);
18151815

1816-
if (newskb)
1816+
if (newskb) {
1817+
spin_lock(&other->sk_receive_queue.lock);
18171818
__skb_queue_tail(&other->sk_receive_queue, newskb);
1819+
spin_unlock(&other->sk_receive_queue.lock);
1820+
}
18181821

18191822
unix_state_unlock(other);
18201823
mutex_unlock(&unix_sk(other)->readlock);

0 commit comments

Comments
 (0)