diff options
| author | Kuniyuki Iwashima <[email protected]> | 2024-06-04 16:52:41 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2024-06-06 10:57:15 +0000 |
| commit | efaf24e30ec39ebbea9112227485805a48b0ceb1 (patch) | |
| tree | 42ca942ab931b6967d93e9183b4712b902993697 /net/unix/diag.c | |
| parent | af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen(). (diff) | |
| download | kernel-efaf24e30ec39ebbea9112227485805a48b0ceb1.tar.gz kernel-efaf24e30ec39ebbea9112227485805a48b0ceb1.zip | |
af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
While dumping sockets via UNIX_DIAG, we do not hold unix_state_lock().
Let's use READ_ONCE() to read sk->sk_shutdown.
Fixes: e4e541a84863 ("sock-diag: Report shutdown for inet and unix sockets (v2)")
Signed-off-by: Kuniyuki Iwashima <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/unix/diag.c')
| -rw-r--r-- | net/unix/diag.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/unix/diag.c b/net/unix/diag.c index 321336f91a0a..937edf4afed4 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c @@ -165,7 +165,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r sock_diag_put_meminfo(sk, skb, UNIX_DIAG_MEMINFO)) goto out_nlmsg_trim; - if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown)) + if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, READ_ONCE(sk->sk_shutdown))) goto out_nlmsg_trim; if ((req->udiag_show & UDIAG_SHOW_UID) && |
