Skip to content

Commit e0bb4ab

Browse files
q2vendavem330
authored andcommitted
tcp: Fix a data-race around sysctl_tcp_min_tso_segs.
While reading sysctl_tcp_min_tso_segs, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 95bd09e ("tcp: TSO packets automatic sizing") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db3815a commit e0bb4ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now)
19951995

19961996
min_tso = ca_ops->min_tso_segs ?
19971997
ca_ops->min_tso_segs(sk) :
1998-
sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs;
1998+
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs);
19991999

20002000
tso_segs = tcp_tso_autosize(sk, mss_now, min_tso);
20012001
return min_t(u32, tso_segs, sk->sk_gso_max_segs);

0 commit comments

Comments
 (0)