netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Francesco Ruggeri <fruggeri@arista.com>
Cc: Andy Roulin <aroulin@nvidia.com>, netdev@vger.kernel.org
Subject: Re: neighbour netlink notifications delivered in wrong order
Date: Tue, 7 Jun 2022 10:32:18 -0700	[thread overview]
Message-ID: <20220607103218.532ff62c@hermes.local> (raw)
In-Reply-To: <CA+HUmGidY4BwEJ0_ArRRUKY7BkERsKomYnOwjPEayNUaS8wv=w@mail.gmail.com>

On Tue, 7 Jun 2022 09:29:45 -0700
Francesco Ruggeri <fruggeri@arista.com> wrote:

> On Mon, Jun 6, 2022 at 8:19 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > On Mon, 6 Jun 2022 19:07:04 -0700
> > Andy Roulin <aroulin@nvidia.com> wrote:
> >  
> > > diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> > > index 54625287ee5b..a91dfcbfc01c 100644
> > > --- a/net/core/neighbour.c
> > > +++ b/net/core/neighbour.c
> > > @@ -2531,23 +2531,19 @@ static int neigh_fill_info(struct sk_buff *skb,
> > > struct neighbour *neigh,
> > >       if (nla_put(skb, NDA_DST, neigh->tbl->key_len, neigh->primary_key))
> > >               goto nla_put_failure;
> > >
> > > -     read_lock_bh(&neigh->lock);
> > >       ndm->ndm_state   = neigh->nud_state;  
> >
> > Accessing neighbor state outside of lock is not safe.
> >
> > But you should be able to use RCU here??  
> 
> I think the patch removes the lock from neigh_fill_info but it then uses it
> to protect all calls to neigh_fill_info, so the access should still be safe.
> In case of __neigh_notify the lock also extends to protect rtnl_notify,
> guaranteeing that the state cannot be changed while the notification
> is in progress (I assume all state changes are protected by the same lock).
> Andy, is that the idea?

Neigh info is already protected by RCU, is per neighbour reader/writer lock
still needed at all?

  reply	other threads:[~2022-06-07 17:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 23:01 neighbour netlink notifications delivered in wrong order Francesco Ruggeri
2022-06-07  2:07 ` Andy Roulin
2022-06-07  3:19   ` Stephen Hemminger
2022-06-07 16:29     ` Francesco Ruggeri
2022-06-07 17:32       ` Stephen Hemminger [this message]
2022-06-07 20:03         ` Francesco Ruggeri
2022-06-08  3:49           ` Andy Roulin
2022-06-09 16:40             ` Francesco Ruggeri
2022-06-10 16:18               ` Francesco Ruggeri
2022-06-16 18:33                 ` Andy Roulin
2023-04-11 19:49                   ` Kevin Mitchell
2023-04-12  0:41             ` Stephen Hemminger
2023-04-12  1:22               ` Stephen Hemminger

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=20220607103218.532ff62c@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=aroulin@nvidia.com \
    --cc=fruggeri@arista.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).