From: Johannes Berg <johannes@sipsolutions.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, Roopa Prabhu <roopa@cumulusnetworks.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [PATCH] bridge: fix bridge netlink RCU usage
Date: Tue, 03 Mar 2015 14:43:33 +0100 [thread overview]
Message-ID: <1425390213.2450.45.camel@sipsolutions.net> (raw)
In-Reply-To: <1425390038.5130.171.camel@edumazet-glaptop2.roam.corp.google.com> (sfid-20150303_144041_415908_D62670A0)
On Tue, 2015-03-03 at 05:40 -0800, Eric Dumazet wrote:
> On Tue, 2015-03-03 at 14:29 +0100, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> >
> > When the STP timer fires, it can call br_ifinfo_notify(),
> > which in turn ends up in the new br_get_link_af_size().
> > This function is annotated to be using RTNL locking, which
> > clearly isn't the case here, and thus lockdep warns:
> >
> > ===============================
> > [ INFO: suspicious RCU usage. ]
> > 3.19.0+ #569 Not tainted
> > -------------------------------
> > net/bridge/br_private.h:204 suspicious rcu_dereference_protected() usage!
> >
> > Fix this by doing RCU locking here.
> >
> > Fixes: b7853d73e39b ("bridge: add vlan info to bridge setlink and dellink notification messages")
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> > ---
> > net/bridge/br_netlink.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> > index 17e0177467f5..c63ac0d13add 100644
> > --- a/net/bridge/br_netlink.c
> > +++ b/net/bridge/br_netlink.c
> > @@ -26,12 +26,15 @@ static size_t br_get_link_af_size(const struct net_device *dev)
> > {
> > struct net_port_vlans *pv;
> >
> > - if (br_port_exists(dev))
> > - pv = nbp_get_vlan_info(br_port_get_rtnl(dev));
> > - else if (dev->priv_flags & IFF_EBRIDGE)
> > + if (br_port_exists(dev)) {
> > + rcu_read_lock();
> > + pv = nbp_get_vlan_info(br_port_get_rcu(dev));
> > + rcu_read_unlock();
>
> right after this rcu_read_unlock(), you no longer are allowed to deref
> pv
Right, that's what I feared, hence my other email :)
But if I reorder it to later it would be OK?
johannes
prev parent reply other threads:[~2015-03-03 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 13:29 [PATCH] bridge: fix bridge netlink RCU usage Johannes Berg
2015-03-03 13:33 ` Johannes Berg
2015-03-03 13:40 ` Eric Dumazet
2015-03-03 13:43 ` Johannes Berg [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=1425390213.2450.45.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=stephen@networkplumber.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 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.