aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-10-09 15:32:35 -0700
committerJakub Kicinski <jakub.kicinski@netronome.com>2019-10-09 21:43:00 -0700
commiteac66402d1c342f07ff38f8d631ff95eb7ad3220 (patch)
treed25d4b62d8f9a01ed18b820307bfb0080a26a28f /net/core/sock.c
parentnet: silence KCSAN warnings around sk_add_backlog() calls (diff)
downloadlinux-dev-eac66402d1c342f07ff38f8d631ff95eb7ad3220.tar.xz
linux-dev-eac66402d1c342f07ff38f8d631ff95eb7ad3220.zip
net: annotate sk->sk_rcvlowat lockless reads
sock_rcvlowat() or int_sk_rcvlowat() might be called without the socket lock for example from tcp_poll(). Use READ_ONCE() to document the fact that other cpus might change sk->sk_rcvlowat under us and avoid KCSAN splats. Use WRITE_ONCE() on write sides too. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 1cf06934da50..b7c5c6ea51ba 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -974,7 +974,7 @@ set_rcvbuf:
if (sock->ops->set_rcvlowat)
ret = sock->ops->set_rcvlowat(sk, val);
else
- sk->sk_rcvlowat = val ? : 1;
+ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
break;
case SO_RCVTIMEO_OLD: