Skip to content

Commit e4a2ebc

Browse files
q2venRezaT4795
authored andcommitted
tcp: Fix data-races around sk_pacing_rate.
[ Upstream commit 59bf6c65a09fff74215517aecffbbdcd67df76e3 ] While reading sysctl_tcp_pacing_(ss|ca)_ratio, they can be changed concurrently. Thus, we need to add READ_ONCE() to their readers. Fixes: 43e122b ("tcp: refine pacing rate determination") 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>
1 parent b6a4f25 commit e4a2ebc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv4/tcp_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,9 @@ static void tcp_update_pacing_rate(struct sock *sk)
902902
* end of slow start and should slow down.
903903
*/
904904
if (tcp_snd_cwnd(tp) < tp->snd_ssthresh / 2)
905-
rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio;
905+
rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio);
906906
else
907-
rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio;
907+
rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio);
908908

909909
rate *= max(tcp_snd_cwnd(tp), tp->packets_out);
910910

0 commit comments

Comments
 (0)