aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorJason Xing <[email protected]>2024-03-08 11:25:04 +0000
committerDavid S. Miller <[email protected]>2024-03-11 10:37:40 +0000
commit683a67da95616c91a85b98e41dc8eefe9f2b29e7 (patch)
tree8db546ff0658cc827f43f0c66cb950d0942e411d /net/ipv4/tcp.c
parentmptcp: annotate a data-race around sysctl_tcp_wmem[0] (diff)
downloadkernel-683a67da95616c91a85b98e41dc8eefe9f2b29e7.tar.gz
kernel-683a67da95616c91a85b98e41dc8eefe9f2b29e7.zip
tcp: annotate a data-race around sysctl_tcp_wmem[0]
When reading wmem[0], it could be changed concurrently without READ_ONCE() protection. So add one annotation here. Signed-off-by: Jason Xing <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b091149742b1..d20b62d52171 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -975,7 +975,7 @@ int tcp_wmem_schedule(struct sock *sk, int copy)
* Use whatever is left in sk->sk_forward_alloc and tcp_wmem[0]
* to guarantee some progress.
*/
- left = sock_net(sk)->ipv4.sysctl_tcp_wmem[0] - sk->sk_wmem_queued;
+ left = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]) - sk->sk_wmem_queued;
if (left > 0)
sk_forced_mem_schedule(sk, min(left, copy));
return min(copy, sk->sk_forward_alloc);