diff options
| author | Kuniyuki Iwashima <[email protected]> | 2024-06-04 16:52:34 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2024-06-06 10:57:14 +0000 |
| commit | af4c733b6b1aded4dc808fafece7dfe6e9d2ebb3 (patch) | |
| tree | 7c3c42ace6d46f7cce5604ea5bc3d651769b0435 /net/unix/af_unix.c | |
| parent | af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg(). (diff) | |
| download | kernel-af4c733b6b1aded4dc808fafece7dfe6e9d2ebb3.tar.gz kernel-af4c733b6b1aded4dc808fafece7dfe6e9d2ebb3.zip | |
af_unix: Annotate data-race of sk->sk_state in unix_stream_read_skb().
unix_stream_read_skb() is called from sk->sk_data_ready() context
where unix_state_lock() is not held.
Let's use READ_ONCE() there.
Fixes: 77462de14a43 ("af_unix: Add read_sock for stream socket types")
Signed-off-by: Kuniyuki Iwashima <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/unix/af_unix.c')
| -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 4ef9c21783a5..e7b74207aa3b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2659,7 +2659,7 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor) { - if (unlikely(sk->sk_state != TCP_ESTABLISHED)) + if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED)) return -ENOTCONN; return unix_read_skb(sk, recv_actor); |
