Skip to content

Commit 2afdbe7

Browse files
q2vendavem330
authored andcommitted
tcp: Fix a data-race around sysctl_tcp_invalid_ratelimit.
While reading sysctl_tcp_invalid_ratelimit, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 032ee42 ("tcp: helpers to mitigate ACK loops by rate-limiting out-of-window dupacks") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 85225e6 commit 2afdbe7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,8 @@ static bool __tcp_oow_rate_limited(struct net *net, int mib_idx,
35813581
if (*last_oow_ack_time) {
35823582
s32 elapsed = (s32)(tcp_jiffies32 - *last_oow_ack_time);
35833583

3584-
if (0 <= elapsed && elapsed < net->ipv4.sysctl_tcp_invalid_ratelimit) {
3584+
if (0 <= elapsed &&
3585+
elapsed < READ_ONCE(net->ipv4.sysctl_tcp_invalid_ratelimit)) {
35853586
NET_INC_STATS(net, mib_idx);
35863587
return true; /* rate-limited: don't send yet! */
35873588
}

0 commit comments

Comments
 (0)