Skip to content

Commit

Permalink
af_unix: take receive queue lock while appending new skb
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Reported-by: Eric Dumazet <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
strssndktn authored and davem330 committed Nov 17, 2015
1 parent b22b941 commit a3a116e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1813,8 +1813,11 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page,
skb->truesize += size;
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);
spin_unlock(&other->sk_receive_queue.lock);
}

unix_state_unlock(other);
mutex_unlock(&unix_sk(other)->readlock);
Expand Down

0 comments on commit a3a116e

Please sign in to comment.