[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+QvbYLFoMkr6NTj2+7eHsZ=s9wo3gpdF1BpH3ejXFEgw@mail.gmail.com>
Date: Fri, 1 Dec 2023 21:41:16 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: gnault@...hat.com, davem@...emloft.net, dsahern@...nel.org,
kuba@...nel.org, mkubecek@...e.cz, netdev@...r.kernel.org, pabeni@...hat.com
Subject: Re: [PATCH net-next v4] tcp: Dump bound-only sockets in inet_diag.
On Fri, Dec 1, 2023 at 9:34 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> From: Guillaume Nault <gnault@...hat.com>
> > + goto next_bind;
> > +
> > + if (sk->sk_state != TCP_CLOSE ||
> > + !inet->inet_num)
>
> Sorry for missing this in the previous version, but I think
> inet_num is always non-zero because 0 selects a port automatically
> and the min of ipv4_local_port_range is 1.
>
This is not true, because it can be cleared by another thread, before
unhashing happens in __inet_put_port()
Note the test should use READ_ONCE(inet->inet_num), but I did not
mention this, as many reads of inet_num are racy.
Powered by blists - more mailing lists