Skip to content

Commit a11e5b3

Browse files
q2vendavem330
authored andcommitted
tcp: Fix data-races around sysctl_tcp_max_reordering.
While reading sysctl_tcp_max_reordering, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: dca145f ("tcp: allow for bigger reordering level") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d17d9c commit a11e5b3

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
@@ -1051,7 +1051,7 @@ static void tcp_check_sack_reordering(struct sock *sk, const u32 low_seq,
10511051
tp->undo_marker ? tp->undo_retrans : 0);
10521052
#endif
10531053
tp->reordering = min_t(u32, (metric + mss - 1) / mss,
1054-
sock_net(sk)->ipv4.sysctl_tcp_max_reordering);
1054+
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_max_reordering));
10551055
}
10561056

10571057
/* This exciting event is worth to be remembered. 8) */
@@ -2030,7 +2030,7 @@ static void tcp_check_reno_reordering(struct sock *sk, const int addend)
20302030
return;
20312031

20322032
tp->reordering = min_t(u32, tp->packets_out + addend,
2033-
sock_net(sk)->ipv4.sysctl_tcp_max_reordering);
2033+
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_max_reordering));
20342034
tp->reord_seen++;
20352035
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRENOREORDER);
20362036
}

0 commit comments

Comments
 (0)