Skip to content

Commit b605875

Browse files
q2venSasha Levin
authored and
Sasha Levin
committed
af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
[ Upstream commit efaf24e ] While dumping sockets via UNIX_DIAG, we do not hold unix_state_lock(). Let's use READ_ONCE() to read sk->sk_shutdown. Fixes: e4e541a ("sock-diag: Report shutdown for inet and unix sockets (v2)") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 89d065b commit b605875

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/unix/diag.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r
165165
sock_diag_put_meminfo(sk, skb, UNIX_DIAG_MEMINFO))
166166
goto out_nlmsg_trim;
167167

168-
if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown))
168+
if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, READ_ONCE(sk->sk_shutdown)))
169169
goto out_nlmsg_trim;
170170

171171
if ((req->udiag_show & UDIAG_SHOW_UID) &&

0 commit comments

Comments
 (0)