From: Stephen Hemminger <shemminger@vyatta.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 3/4] bridge: multicast port group RCU fix
Date: Tue, 27 Apr 2010 20:47:19 -0700 [thread overview]
Message-ID: <20100427204719.5cef8d54@nehalam> (raw)
In-Reply-To: <20100428030709.GA12910@gondor.apana.org.au>
On Wed, 28 Apr 2010 11:07:09 +0800
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Tue, Apr 27, 2010 at 06:01:06PM -0700, Stephen Hemminger wrote:
> > The recently introduced bridge mulitcast port group list was only
> > partially using RCU correctly. It was missing rcu_dereference()
> > and missing the necessary barrier on deletion.
> >
> > The code should have used one of the standard list methods (list or hlist)
> > instead of open coding a RCU based link list.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> > --- a/net/bridge/br_forward.c 2010-04-27 17:51:27.909588950 -0700
> > +++ b/net/bridge/br_forward.c 2010-04-27 17:53:18.790721091 -0700
> > @@ -217,7 +217,7 @@ static void br_multicast_flood(struct ne
> > prev = NULL;
> >
> > rp = rcu_dereference(br->router_list.first);
> > - p = mdst ? mdst->ports : NULL;
> > + p = mdst ? rcu_dereference(mdst->ports) : NULL;
> > while (p || rp) {
> > lport = p ? p->port : NULL;
> > rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) :
> > @@ -231,7 +231,7 @@ static void br_multicast_flood(struct ne
> > goto out;
> >
> > if ((unsigned long)lport >= (unsigned long)port)
> > - p = p->next;
> > + p = rcu_dereference(p->next);
> > if ((unsigned long)rport >= (unsigned long)port)
> > rp = rcu_dereference(rp->next);
> > }
>
> Thanks for catching this!
>
> > --- a/net/bridge/br_multicast.c 2010-04-27 17:51:31.509593914 -0700
> > +++ b/net/bridge/br_multicast.c 2010-04-27 17:52:48.209243982 -0700
> > @@ -259,7 +259,7 @@ static void br_multicast_del_pg(struct n
> > if (p != pg)
> > continue;
> >
> > - *pp = p->next;
> > + rcu_assign_pointer(*pp, p->next);
>
> But this is bogus. br_multicast_del_pg is removing an entry from
> the RCU list.
>
> You only need write barriers when you're putting a new entry in
> it, and only if there is no other barrier between the code filling
> in the new entry and the line adding it to the RCU list.
Yeah, it is extra barrier (one more reason to stick to hlist_del_rcu)
--
next prev parent reply other threads:[~2010-04-28 3:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-28 1:01 [PATCH net-next 0/4] Bridge IGMP cleanup and fixes Stephen Hemminger
2010-04-28 1:01 ` [PATCH net-next 1/4] bridge: simplify multicast_add_router Stephen Hemminger
2010-04-28 1:01 ` [PATCH net-next 2/4] bridge: multicast flood Stephen Hemminger
2010-04-28 1:01 ` [PATCH net-next 3/4] bridge: multicast port group RCU fix Stephen Hemminger
2010-04-28 3:07 ` Herbert Xu
2010-04-28 3:47 ` Stephen Hemminger [this message]
2010-04-28 1:01 ` [PATCH net-next 4/4] bridge: multicast_flood cleanup Stephen Hemminger
2010-04-28 1:14 ` [PATCH net-next 0/4] Bridge IGMP cleanup and fixes David Miller
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=20100427204719.5cef8d54@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--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