diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-06-05 16:23:25 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-14 18:11:57 +0200 |
commit | 556720013c36c193d9cbfb06e7b33e51f0c39fbf (patch) | |
tree | c42a697ad3c2244e805fb0ec84f35dcfbf875aea | |
parent | b49c884146e20314808c9420640b26876ff55c80 (diff) | |
download | linux-stable-556720013c36c193d9cbfb06e7b33e51f0c39fbf.tar.gz linux-stable-556720013c36c193d9cbfb06e7b33e51f0c39fbf.tar.bz2 linux-stable-556720013c36c193d9cbfb06e7b33e51f0c39fbf.zip |
af_unix: Fix a data-race in unix_dgram_peer_wake_me().
[ Upstream commit 662a80946ce13633ae90a55379f1346c10f0c432 ]
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: 7d267278a9ec ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/unix/af_unix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 05470ca91bd9..f33e90bd0683 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -440,7 +440,7 @@ static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) * -ECONNREFUSED. Otherwise, if we haven't queued any skbs * to other and its full, we will hang waiting for POLLOUT. */ - if (unix_recvq_full(other) && !sock_flag(other, SOCK_DEAD)) + if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD)) return 1; if (connected) |