tcp: Fix data-races around sysctl_tcp_fastopen.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 15 Jul 2022 17:17:54 +0000 (10:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:19 +0000 (17:25 +0200)
commit539d9ab79eba3974b479cad61a8688c41fe62e12
tree9eb5d09a2d512ab279f577a5bb3e3b090cdb3c43
parent3ae85dc62a023ca0956f8f26628494af51a6a824
tcp: Fix data-races around sysctl_tcp_fastopen.

[ Upstream commit 5a54213318c43f4009ae158347aa6016e3b9b55a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/af_inet.c
net/ipv4/tcp.c
net/ipv4/tcp_fastopen.c