Skip to content

Commit d3f4418

Browse files
author
Guillaume Nault
committed
tcp: Fix data-races around sysctl_tcp_fastopen_blackhole_timeout.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949 Upstream Status: linux.git commit 021266e Author: Kuniyuki Iwashima <kuniyu@amazon.com> Date: Fri Jul 15 10:17:55 2022 -0700 tcp: Fix data-races around sysctl_tcp_fastopen_blackhole_timeout. While reading sysctl_tcp_fastopen_blackhole_timeout, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: cf1ef3f ("net/tcp_fastopen: Disable active side TFO in certain scenarios") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Guillaume Nault <gnault@redhat.com>
1 parent 284b4d5 commit d3f4418

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/ipv4/tcp_fastopen.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void tcp_fastopen_active_disable(struct sock *sk)
507507
{
508508
struct net *net = sock_net(sk);
509509

510-
if (!sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout)
510+
if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout))
511511
return;
512512

513513
/* Paired with READ_ONCE() in tcp_fastopen_active_should_disable() */
@@ -528,7 +528,8 @@ void tcp_fastopen_active_disable(struct sock *sk)
528528
*/
529529
bool tcp_fastopen_active_should_disable(struct sock *sk)
530530
{
531-
unsigned int tfo_bh_timeout = sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout;
531+
unsigned int tfo_bh_timeout =
532+
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout);
532533
unsigned long timeout;
533534
int tfo_da_times;
534535
int multiplier;

0 commit comments

Comments
 (0)