From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>
Subject: [PATCH v1 net 3/7] tcp: Fix a data-race around sysctl_tcp_comp_sack_delay_ns.
Date: Fri, 22 Jul 2022 11:22:01 -0700 [thread overview]
Message-ID: <20220722182205.96838-4-kuniyu@amazon.com> (raw)
In-Reply-To: <20220722182205.96838-1-kuniyu@amazon.com>
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>
---
net/ipv4/tcp_input.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ff2e0d87aee4..813744180d87 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5542,7 +5542,8 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
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),
--
2.30.2
next prev parent reply other threads:[~2022-07-22 18:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 18:21 [PATCH v1 net 0/7] sysctl: Fix data-races around ipv4_net_table (Round 6, Final) Kuniyuki Iwashima
2022-07-22 18:21 ` [PATCH v1 net 1/7] tcp: Fix data-races around sk_pacing_rate Kuniyuki Iwashima
2022-07-22 18:22 ` [PATCH v1 net 2/7] net: Fix data-races around sysctl_[rw]mem(_offset)? Kuniyuki Iwashima
2022-07-22 18:22 ` Kuniyuki Iwashima [this message]
2022-07-22 18:22 ` [PATCH v1 net 4/7] tcp: Fix a data-race around sysctl_tcp_comp_sack_slack_ns Kuniyuki Iwashima
2022-07-22 18:22 ` [PATCH v1 net 5/7] tcp: Fix a data-race around sysctl_tcp_comp_sack_nr Kuniyuki Iwashima
2022-07-22 18:22 ` [PATCH v1 net 6/7] tcp: Fix data-races around sysctl_tcp_reflect_tos Kuniyuki Iwashima
2022-07-22 18:58 ` Wei Wang
2022-07-22 18:22 ` [PATCH v1 net 7/7] ipv4: Fix data-races around sysctl_fib_notify_on_flag_change Kuniyuki Iwashima
2022-07-25 12:30 ` [PATCH v1 net 0/7] sysctl: Fix data-races around ipv4_net_table (Round 6, Final) patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220722182205.96838-4-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.