mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
af_unix: Annotate data-race of sk->sk_state in unix_accept().
[ Upstream commit1b536948e8
] Once sk->sk_state is changed to TCP_LISTEN, it never changes. unix_accept() takes the advantage and reads sk->sk_state without holding unix_state_lock(). Let's use READ_ONCE() there. Fixes:1da177e4c3
("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b82c97a79b
commit
6fdc1152af
1 changed files with 1 additions and 1 deletions
|
@ -1710,7 +1710,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags,
|
|||
goto out;
|
||||
|
||||
err = -EINVAL;
|
||||
if (sk->sk_state != TCP_LISTEN)
|
||||
if (READ_ONCE(sk->sk_state) != TCP_LISTEN)
|
||||
goto out;
|
||||
|
||||
/* If socket state is TCP_LISTEN it cannot change (for now...),
|
||||
|
|
Loading…
Reference in a new issue