Skip to content

Commit 2239694

Browse files
q2vendavem330
authored andcommitted
tcp: Fix a data-race around sysctl_tcp_comp_sack_slack_ns.
While reading sysctl_tcp_comp_sack_slack_ns, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: a70437c ("tcp: add hrtimer slack to sack compression") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4866b2b commit 2239694

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5547,7 +5547,7 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
55475547
rtt * (NSEC_PER_USEC >> 3)/20);
55485548
sock_hold(sk);
55495549
hrtimer_start_range_ns(&tp->compressed_ack_timer, ns_to_ktime(delay),
5550-
sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns,
5550+
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns),
55515551
HRTIMER_MODE_REL_PINNED_SOFT);
55525552
}
55535553

0 commit comments

Comments
 (0)