All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 3/3] inet: ping: make ping_port_rover per netns
Date: Wed, 27 Aug 2025 09:07:05 -0600	[thread overview]
Message-ID: <d2739db2-74bd-4c1f-8f8a-ffaa70f227dd@kernel.org> (raw)
In-Reply-To: <CANn89iKdv2OfNm2=iRW6vGqOUsxZbDf9vZ5DdagkFTZzXoPQQQ@mail.gmail.com>

On 8/27/25 9:00 AM, Eric Dumazet wrote:
> On Wed, Aug 27, 2025 at 7:57 AM David Ahern <dsahern@kernel.org> wrote:
>>
>> On 8/27/25 6:05 AM, Eric Dumazet wrote:
>>> @@ -84,12 +82,12 @@ int ping_get_port(struct sock *sk, unsigned short ident)
>>>       isk = inet_sk(sk);
>>>       spin_lock(&ping_table.lock);
>>>       if (ident == 0) {
>>> +             u16 result = net->ipv4.ping_port_rover + 1;
>>>               u32 i;
>>> -             u16 result = ping_port_rover + 1;
>>>
>>>               for (i = 0; i < (1L << 16); i++, result++) {
>>>                       if (!result)
>>> -                             result++; /* avoid zero */
>>> +                             continue; /* avoid zero */
>>>                       hlist = ping_hashslot(&ping_table, net, result);
>>>                       sk_for_each(sk2, hlist) {
>>>                               if (!net_eq(sock_net(sk2), net))
>>> @@ -101,7 +99,7 @@ int ping_get_port(struct sock *sk, unsigned short ident)
>>>                       }
>>>
>>>                       /* found */
>>> -                     ping_port_rover = ident = result;
>>> +                     net->ipv4.ping_port_rover = ident = result;
>>
>> READ_ONCE above and WRITE_ONCE here?
> 
> Note we hold ping_table.lock for both the read and write,
> so there is no need for READ_ONCE() or WRITE_ONCE() here.
> 
> Thank you !

missed that.

Reviewed-by: David Ahern <dsahern@kernel.org>


      reply	other threads:[~2025-08-27 15:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 12:05 [PATCH net-next 0/3] inet: ping: misc changes Eric Dumazet
2025-08-27 12:05 ` [PATCH net-next 1/3] inet: ping: check sock_net() in ping_get_port() Eric Dumazet
2025-08-27 14:50   ` David Ahern
2025-08-27 16:12     ` Eric Dumazet
2025-08-27 12:05 ` [PATCH net-next 2/3] inet: ping: remove ping_hash() Eric Dumazet
2025-08-27 14:52   ` David Ahern
2025-08-27 12:05 ` [PATCH net-next 3/3] inet: ping: make ping_port_rover per netns Eric Dumazet
2025-08-27 14:57   ` David Ahern
2025-08-27 15:00     ` Eric Dumazet
2025-08-27 15:07       ` David Ahern [this message]

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=d2739db2-74bd-4c1f-8f8a-ffaa70f227dd@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --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.