From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <edumazet@google.com>
Cc: <davem@davemloft.net>, <dsahern@kernel.org>, <gnault@redhat.com>,
<kuba@kernel.org>, <kuniyu@amazon.com>, <mkubecek@suse.cz>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>
Subject: Re: [PATCH net-next v4] tcp: Dump bound-only sockets in inet_diag.
Date: Fri, 1 Dec 2023 13:23:34 -0800 [thread overview]
Message-ID: <20231201212334.28857-1-kuniyu@amazon.com> (raw)
In-Reply-To: <CANn89i+QvbYLFoMkr6NTj2+7eHsZ=s9wo3gpdF1BpH3ejXFEgw@mail.gmail.com>
From: Eric Dumazet <edumazet@google.com>
Date: Fri, 1 Dec 2023 21:41:16 +0100
> On Fri, Dec 1, 2023 at 9:34 PM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
> >
> > From: Guillaume Nault <gnault@redhat.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.
Ah exactly, the order of __sk_del_bind_node() and the clearance was not
guaranteed.
Thanks!
next prev parent reply other threads:[~2023-12-01 21:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 14:49 [PATCH net-next v4] tcp: Dump bound-only sockets in inet_diag Guillaume Nault
2023-12-01 20:34 ` Kuniyuki Iwashima
2023-12-01 20:41 ` Eric Dumazet
2023-12-01 21:23 ` Kuniyuki Iwashima [this message]
2023-12-04 10:58 ` Guillaume Nault
2023-12-04 12:31 ` Eric Dumazet
2023-12-04 23:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231201212334.28857-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gnault@redhat.com \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.