summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-20 09:50:18 -0700
committerDavid S. Miller <davem@davemloft.net>2022-07-22 12:06:17 +0100
commit780476488844e070580bfc9e3bc7832ec1cea883 (patch)
tree1c5eccb931a4222e45ac290ef3c7334db3a0df50 /net/ipv4
parentab1ba21b523ab496b1a4a8e396333b24b0a18f9a (diff)
downloadlinux-780476488844e070580bfc9e3bc7832ec1cea883.tar.gz
linux-780476488844e070580bfc9e3bc7832ec1cea883.tar.bz2
linux-780476488844e070580bfc9e3bc7832ec1cea883.zip
tcp: Fix data-races around sysctl_tcp_moderate_rcvbuf.
While reading sysctl_tcp_moderate_rcvbuf, it can be changed concurrently. Thus, we need to add READ_ONCE() to its 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')
-rw-r--r--net/ipv4/tcp_input.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index af376d7423d1..debfff94f3af 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -724,7 +724,7 @@ void tcp_rcv_space_adjust(struct sock *sk)
* <prev RTT . ><current RTT .. ><next RTT .... >
*/
- if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf &&
+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) &&
!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
int rcvmem, rcvbuf;
u64 rcvwin, grow;