Skip to content

Commit b192812

Browse files
q2vendavem330
authored andcommitted
af_unix: Fix data race around sk->sk_err.
As with sk->sk_shutdown shown in the previous patch, sk->sk_err can be read locklessly by unix_dgram_sendmsg(). Let's use READ_ONCE() for sk_err as well. Note that the writer side is marked by commit cc04410 ("af_unix: annotate lockless accesses to sk->sk_err"). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent afe8764 commit b192812

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/sock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2749,7 +2749,7 @@ static long sock_wait_for_wmem(struct sock *sk, long timeo)
27492749
break;
27502750
if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
27512751
break;
2752-
if (sk->sk_err)
2752+
if (READ_ONCE(sk->sk_err))
27532753
break;
27542754
timeo = schedule_timeout(timeo);
27552755
}

0 commit comments

Comments
 (0)