All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
	davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org,
	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: Mon, 4 Dec 2023 11:58:37 +0100	[thread overview]
Message-ID: <ZW2w3YyNMoyN1t97@debian> (raw)
In-Reply-To: <CANn89i+QvbYLFoMkr6NTj2+7eHsZ=s9wo3gpdF1BpH3ejXFEgw@mail.gmail.com>

On Fri, Dec 01, 2023 at 09:41:16PM +0100, Eric Dumazet wrote:
> 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.

Would you like me to send a v5, or do you prefer to let a future series
fix all the racy reads and writes at once?

Personally, I feel it'd look strange to have a READ_ONCE() only in
inet_diag_dump_icsk(), while the rest of the stack accesses it
directly. But just let me know if you feel otherwise and I'll post a
v5.


  parent reply	other threads:[~2023-12-04 10:58 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
2023-12-04 10:58     ` Guillaume Nault [this message]
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=ZW2w3YyNMoyN1t97@debian \
    --to=gnault@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --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.