diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-15 19:17:54 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-07-18 13:21:54 +0200 |
commit | 5a54213318c43f4009ae158347aa6016e3b9b55a (patch) | |
tree | 35efe5034a35dcd8dbee8b0d93d7c03b48dc2d87 /net/ipv4/af_inet.c | |
parent | tcp: Fix data-races around sysctl_max_syn_backlog. (diff) | |
download | linux-5a54213318c43f4009ae158347aa6016e3b9b55a.tar.xz linux-5a54213318c43f4009ae158347aa6016e3b9b55a.zip |
tcp: Fix data-races around sysctl_tcp_fastopen.
While reading sysctl_tcp_fastopen, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its readers.
Fixes: 2100c8d2d9db ("net-tcp: Fast Open base")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 8baef2f3fc4b..252c8bceaba4 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -217,7 +217,7 @@ int inet_listen(struct socket *sock, int backlog) * because the socket was in TCP_LISTEN state previously but * was shutdown() rather than close(). */ - tcp_fastopen = sock_net(sk)->ipv4.sysctl_tcp_fastopen; + tcp_fastopen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen); if ((tcp_fastopen & TFO_SERVER_WO_SOCKOPT1) && (tcp_fastopen & TFO_SERVER_ENABLE) && !inet_csk(sk)->icsk_accept_queue.fastopenq.max_qlen) { |