diff options
author | Eric Dumazet <edumazet@google.com> | 2023-07-19 23:28:52 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-07-20 21:34:18 +0200 |
commit | 3a037f0f3c4bfe44518f2fbb478aa2f99a9cd8bb (patch) | |
tree | 2f5d3a67231c9e4f1ca93e4458b4ccfb0554efe6 /net/ipv4/tcp.c | |
parent | tcp: annotate data-races around tp->keepalive_probes (diff) | |
download | linux-3a037f0f3c4bfe44518f2fbb478aa2f99a9cd8bb.tar.xz linux-3a037f0f3c4bfe44518f2fbb478aa2f99a9cd8bb.zip |
tcp: annotate data-races around icsk->icsk_syn_retries
do_tcp_getsockopt() and reqsk_timer_handler() read
icsk->icsk_syn_retries while another cpu might change its value.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230719212857.3943972-7-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | net/ipv4/tcp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 574fd0da1673..9f74ac16f1c1 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3291,7 +3291,7 @@ int tcp_sock_set_syncnt(struct sock *sk, int val) return -EINVAL; lock_sock(sk); - inet_csk(sk)->icsk_syn_retries = val; + WRITE_ONCE(inet_csk(sk)->icsk_syn_retries, val); release_sock(sk); return 0; } @@ -3572,7 +3572,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname, if (val < 1 || val > MAX_TCP_SYNCNT) err = -EINVAL; else - icsk->icsk_syn_retries = val; + WRITE_ONCE(icsk->icsk_syn_retries, val); break; case TCP_SAVE_SYN: @@ -3993,7 +3993,7 @@ int do_tcp_getsockopt(struct sock *sk, int level, val = keepalive_probes(tp); break; case TCP_SYNCNT: - val = icsk->icsk_syn_retries ? : + val = READ_ONCE(icsk->icsk_syn_retries) ? : READ_ONCE(net->ipv4.sysctl_tcp_syn_retries); break; case TCP_LINGER2: |