diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-22 11:22:01 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-03 12:03:51 +0200 |
commit | 6842c94de9d5b25e0fbfa3402f4c3d6a382f7fae (patch) | |
tree | 26c115639e9c452d1c82b5c8795f9fa4b37f6d85 /net/ipv4 | |
parent | 618116a273b7a4df296296bd1b4057e41b77e9f1 (diff) | |
download | linux-stable-6842c94de9d5b25e0fbfa3402f4c3d6a382f7fae.tar.gz linux-stable-6842c94de9d5b25e0fbfa3402f4c3d6a382f7fae.tar.bz2 linux-stable-6842c94de9d5b25e0fbfa3402f4c3d6a382f7fae.zip |
tcp: Fix a data-race around sysctl_tcp_comp_sack_delay_ns.
[ Upstream commit 4866b2b0f7672b6d760c4b8ece6fb56f965dcc8a ]
While reading sysctl_tcp_comp_sack_delay_ns, it can be changed
concurrently. Thus, we need to add READ_ONCE() to its reader.
Fixes: 6d82aa242092 ("tcp: add tcp_comp_sack_delay_ns sysctl")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp_input.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e007bdc20e82..486ca1d5b436 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5512,7 +5512,8 @@ send_now: if (tp->srtt_us && tp->srtt_us < rtt) rtt = tp->srtt_us; - delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns, + delay = min_t(unsigned long, + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns), rtt * (NSEC_PER_USEC >> 3)/20); sock_hold(sk); hrtimer_start_range_ns(&tp->compressed_ack_timer, ns_to_ktime(delay), |