summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-15 10:17:46 -0700
committerDavid S. Miller <davem@davemloft.net>2022-07-18 12:21:54 +0100
commit20a3b1c0f603e8c55c3396abd12dfcfb523e4d3c (patch)
treede4a9c1b28887f2a09cdbb7b087a8f1005b51bde /net/ipv4/tcp.c
parentf2f316e287e6c2e3a1c5bab8d9b77ee03daa0463 (diff)
downloadlinux-20a3b1c0f603e8c55c3396abd12dfcfb523e4d3c.tar.gz
linux-20a3b1c0f603e8c55c3396abd12dfcfb523e4d3c.tar.bz2
linux-20a3b1c0f603e8c55c3396abd12dfcfb523e4d3c.zip
tcp: Fix data-races around sysctl_tcp_syn(ack)?_retries.
While reading sysctl_tcp_syn(ack)?_retries, they can be changed concurrently. Thus, we need to add READ_ONCE() to their readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2222dfdde316..19ce08c9fbdc 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3967,7 +3967,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
val = keepalive_probes(tp);
break;
case TCP_SYNCNT:
- val = icsk->icsk_syn_retries ? : net->ipv4.sysctl_tcp_syn_retries;
+ val = icsk->icsk_syn_retries ? :
+ READ_ONCE(net->ipv4.sysctl_tcp_syn_retries);
break;
case TCP_LINGER2:
val = tp->linger2;