Skip to content

Commit 8499a24

Browse files
q2vendavem330
authored andcommitted
tcp: Fix a data-race around sysctl_tcp_nometrics_save.
While reading sysctl_tcp_nometrics_save, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 706c620 commit 8499a24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp_metrics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ void tcp_update_metrics(struct sock *sk)
329329
int m;
330330

331331
sk_dst_confirm(sk);
332-
if (net->ipv4.sysctl_tcp_nometrics_save || !dst)
332+
if (READ_ONCE(net->ipv4.sysctl_tcp_nometrics_save) || !dst)
333333
return;
334334

335335
rcu_read_lock();

0 commit comments

Comments
 (0)