netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: roopa <roopa@cumulusnetworks.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: netdev@vger.kernel.org,
	Stephen Hemminger <stephen@networkplumber.org>,
	Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH v4] bridge: fix bridge netlink RCU usage
Date: Tue, 03 Mar 2015 08:08:51 -0800	[thread overview]
Message-ID: <54F5DC93.1040600@cumulusnetworks.com> (raw)
In-Reply-To: <1425394936-11595-1-git-send-email-johannes@sipsolutions.net>

On 3/3/15, 7:02 AM, 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 | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 3de0eefe2b82..c72083968768 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -81,17 +81,19 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev,
>   	struct net_port_vlans *pv;
>   	int num_vlan_infos;
>   
> +	rcu_read_lock();
>   	if (br_port_exists(dev))
> -		pv = nbp_get_vlan_info(br_port_get_rtnl(dev));
> +		pv = nbp_get_vlan_info(br_port_get_rcu(dev));
>   	else if (dev->priv_flags & IFF_EBRIDGE)
>   		pv = br_get_vlan_info((struct net_bridge *)netdev_priv(dev));
>   	else
> -		return 0;
> -
> -	if (!pv)
> -		return 0;
> +		pv = NULL;
> +	if (pv)
> +		num_vlan_infos = br_get_num_vlan_infos(pv, filter_mask);
> +	else
> +		num_vlan_infos = 0;
> +	rcu_read_unlock();
>   
> -	num_vlan_infos = br_get_num_vlan_infos(pv, filter_mask);
>   	if (!num_vlan_infos)
>   		return 0;
>   
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>

The patch may have to be marked with prefix 'net-next' ?. (unless dave 
infers it from the thread)

Thanks again!

  reply	other threads:[~2015-03-03 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 15:02 [PATCH v4] bridge: fix bridge netlink RCU usage Johannes Berg
2015-03-03 16:08 ` roopa [this message]
2015-03-04  5:20 ` 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=54F5DC93.1040600@cumulusnetworks.com \
    --to=roopa@cumulusnetworks.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=netdev@vger.kernel.org \
    --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 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).