Skip to content

Commit 662a809

Browse files
q2venPaolo Abeni
authored andcommitted
af_unix: Fix a data-race in unix_dgram_peer_wake_me().
unix_dgram_poll() calls unix_dgram_peer_wake_me() without `other`'s lock held and check if its receive queue is full. Here we need to use unix_recvq_full_lockless() instead of unix_recvq_full(), otherwise KCSAN will report a data-race. Fixes: 7d26727 ("unix: avoid use-after-free in ep_remove_wait_queue") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://lore.kernel.org/r/20220605232325.11804-1-kuniyu@amazon.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 5e74a4b commit 662a809

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/unix/af_unix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
490490
* -ECONNREFUSED. Otherwise, if we haven't queued any skbs
491491
* to other and its full, we will hang waiting for POLLOUT.
492492
*/
493-
if (unix_recvq_full(other) && !sock_flag(other, SOCK_DEAD))
493+
if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD))
494494
return 1;
495495

496496
if (connected)

0 commit comments

Comments
 (0)