tcp: annotate sk->sk_rcvbuf lockless reads
For the sake of tcp_poll(), there are few places where we fetch sk->sk_rcvbuf while this field can change from IRQ or other cpu. We need to add READ_ONCE() annotations, and also make sure write sides use corresponding WRITE_ONCE() to avoid store-tearing. Note that other transports probably need similar fixes. Signed-off-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
d9b55bf7b6
commit
ebb3b78db7
@@ -4415,7 +4415,7 @@ static void skb_set_err_queue(struct sk_buff *skb)
|
||||
int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
|
||||
(unsigned int)sk->sk_rcvbuf)
|
||||
(unsigned int)READ_ONCE(sk->sk_rcvbuf))
|
||||
return -ENOMEM;
|
||||
|
||||
skb_orphan(skb);
|
||||
|
Reference in New Issue
Block a user