]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tcp: Fix a data-race around sysctl_tcp_early_retrans.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Mon, 18 Jul 2022 17:26:45 +0000 (10:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Jul 2022 09:14:49 +0000 (10:14 +0100)
While reading sysctl_tcp_early_retrans, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its reader.

Fixes: 8ebd7bee9079 ("tcp: early retransmit")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_output.c

index 38a71e711edc9d6da4b7abb12d27faa4e8ce156e..898fcdcb7989b107e1ec0a215f2757feb628b18c 100644 (file)
@@ -2741,7 +2741,7 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto)
        if (rcu_access_pointer(tp->fastopen_rsk))
                return false;
 
-       early_retrans = sock_net(sk)->ipv4.sysctl_tcp_early_retrans;
+       early_retrans = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_early_retrans);
        /* Schedule a loss probe in 2*RTT for SACK capable connections
         * not in loss recovery, that are either limited by cwnd or application.
         */