Re: [PATCH] skbuff: fix a data race in skb_queue_len()

From: Qian Cai
Date: Mon Feb 03 2020 - 15:19:21 EST




> On Feb 3, 2020, at 2:42 PM, Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
>
> We do not want to add READ_ONCE() for all uses of skb_queue_len()
>
> This could hide some real bugs, and could generate slightly less
> efficient code in the cases we have the lock held.

Good point. I should have thought about that. How about introducing 2 new helpers.

skb_queue_len_once()
unix_recvq_full_once()

which will have a READ_ONCE() there, and then unix_dgram_sendmsg() could use that instead?