mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-04 21:49:11 +08:00
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 <kernelxing@tencent.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
9eb430d40e
commit
683a67da95
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user