diff options
author | Eric Dumazet <edumazet@google.com> | 2019-10-10 20:17:45 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-13 10:13:08 -0700 |
commit | e292f05e0df73f9fcc93329663936e1ded97a988 (patch) | |
tree | 441d2a07b24a8dc89e22f14b373ccbcdf6377b34 /net/core/filter.c | |
parent | ebb3b78db7bf842270a46fd4fe7cc45c78fa5ed6 (diff) | |
download | linux-stable-e292f05e0df73f9fcc93329663936e1ded97a988.tar.gz linux-stable-e292f05e0df73f9fcc93329663936e1ded97a988.tar.bz2 linux-stable-e292f05e0df73f9fcc93329663936e1ded97a988.zip |
tcp: annotate sk->sk_sndbuf lockless reads
For the sake of tcp_poll(), there are few places where we fetch
sk->sk_sndbuf while this field can change from IRQ or other cpu.
We need to add READ_ONCE() annotations, and also make sure write
sides use corresponding WRITE_ONCE() to avoid store-tearing.
Note that other transports probably need similar fixes.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/filter.c')
-rw-r--r-- | net/core/filter.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 7deceaeeed7b..3fed5755494b 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4258,7 +4258,8 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, case SO_SNDBUF: val = min_t(u32, val, sysctl_wmem_max); sk->sk_userlocks |= SOCK_SNDBUF_LOCK; - sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); + WRITE_ONCE(sk->sk_sndbuf, + max_t(int, val * 2, SOCK_MIN_SNDBUF)); break; case SO_MAX_PACING_RATE: /* 32bit version */ if (val != ~0U) |