Skip to content

Commit 59bf6c6

Browse files
q2vendavem330
authored andcommitted
tcp: Fix data-races around sk_pacing_rate.
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>
1 parent 3e7d18b commit 59bf6c6

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
@@ -910,9 +910,9 @@ static void tcp_update_pacing_rate(struct sock *sk)
910910
* end of slow start and should slow down.
911911
*/
912912
if (tcp_snd_cwnd(tp) < tp->snd_ssthresh / 2)
913-
rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio;
913+
rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio);
914914
else
915-
rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio;
915+
rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio);
916916

917917
rate *= max(tcp_snd_cwnd(tp), tp->packets_out);
918918

0 commit comments

Comments
 (0)