Commit b1928129 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by David S. Miller

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 cc04410a ("af_unix:
annotate lockless accesses to sk->sk_err").

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent afe8764f
...@@ -2749,7 +2749,7 @@ static long sock_wait_for_wmem(struct sock *sk, long timeo) ...@@ -2749,7 +2749,7 @@ static long sock_wait_for_wmem(struct sock *sk, long timeo)
break; break;
if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
break; break;
if (sk->sk_err) if (READ_ONCE(sk->sk_err))
break; break;
timeo = schedule_timeout(timeo); timeo = schedule_timeout(timeo);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment