[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8f596e31e1d24f418fa1c6b1a2bae5fc00746e33.camel@redhat.com>
Date: Tue, 23 Jan 2024 09:15:18 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: linke li <lilinke99@...com>, netdev@...r.kernel.org
Subject: Re: [PATCH] net: use READ_ONCE() to read in concurrent environment
On Tue, 2024-01-23 at 04:24 +0800, linke li wrote:
> In function sk_stream_wait_memory(), reads of sk->sk_err and sk->sk_shutdown
> is protected using READ_ONCE() in line 145, 146.
> 145: ret = sk_wait_event(sk, ¤t_timeo, READ_ONCE(sk->sk_err) ||
> 146: (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) ||
The above read happens outside the sk socket lock, see the
sk_wait_event() macro definition...
>
> But reads in line 133 are not protected.
... while the above one happens under the sk socket lock. The _ONCE
annotation is not needed.
> This may cause unexpected error
> when other threads change sk->sk_err and sk->sk_shutdown. Function
> sk_stream_wait_connect() has same problem.
Same as above, the access with the _ONCE() annotation is outside the
socket lock and vice versa.
I think this patch is not needed.
Thanks,
Paolo
Powered by blists - more mailing lists