netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <cwang@twopensource.com>
To: Dominick Grift <dac.override@gmail.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: Suspicious RCU usage in bridge with Linux v4.0-9362-g1fc149933fd4
Date: Mon, 4 May 2015 11:45:41 -0700	[thread overview]
Message-ID: <CAHA+R7PAzzz+CZfnOoweBdeLY8tRkr2bSDEpQgdtEKUeaZbWpQ@mail.gmail.com> (raw)
In-Reply-To: <20150504133943.GA17043@x131e>

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

On Mon, May 4, 2015 at 6:39 AM, Dominick Grift <dac.override@gmail.com> wrote:
> On Thu, Apr 23, 2015 at 01:07:45PM -0400, Josh Boyer wrote:
>> Hi All,
>>
>> We've had a user report the following backtrace from the bridge module
>> with a recent Linus' tree.  Has anything like this been reported yet?
>> If you have any questions on setup, the user is CC'd.
>>
>> josh
>>
>> [   29.382235] br0: port 1(tap0) entered forwarding state
>>
>> [   29.382286] ===============================
>> [   29.382315] [ INFO: suspicious RCU usage. ]
>> [   29.382344] 4.1.0-0.rc0.git11.1.fc23.x86_64 #1 Not tainted
>> [   29.382380] -------------------------------
>> [   29.382409] net/bridge/br_private.h:626 suspicious
>> rcu_dereference_check() usage!
>
> <snip>
>
> With 4.1.0-0.rc1.git1.1.fc23.x86_64 the situation seems to have slightly changed:
>

Should be the same issue. Please give the attached patch a try,
it is compile-tested only.

Thanks!

[-- Attachment #2: br.diff --]
[-- Type: text/plain, Size: 1708 bytes --]

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 4b5c236..8ba989a 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -325,22 +325,28 @@ static int br_fill_ifinfo(struct sk_buff *skb,
 		struct nlattr *af;
 		int err;
 
+		rcu_read_lock();
 		if (port)
 			pv = nbp_get_vlan_info(port);
 		else
 			pv = br_get_vlan_info(br);
 
-		if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID))
+		if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) {
+			rcu_read_unlock();
 			goto done;
+		}
 
 		af = nla_nest_start(skb, IFLA_AF_SPEC);
-		if (!af)
+		if (!af) {
+			rcu_read_unlock();
 			goto nla_put_failure;
+		}
 
 		if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
 			err = br_fill_ifvlaninfo_compressed(skb, pv);
 		else
 			err = br_fill_ifvlaninfo(skb, pv);
+		rcu_read_unlock();
 		if (err)
 			goto nla_put_failure;
 		nla_nest_end(skb, af);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 3362c29..860832e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -617,13 +617,17 @@ int nbp_vlan_init(struct net_bridge_port *port);
 static inline struct net_port_vlans *br_get_vlan_info(
 						const struct net_bridge *br)
 {
-	return rcu_dereference_rtnl(br->vlan_info);
+	return rcu_dereference_protected(br->vlan_info,
+					 rcu_read_lock_held() ||
+					 lockdep_rtnl_is_held());
 }
 
 static inline struct net_port_vlans *nbp_get_vlan_info(
 						const struct net_bridge_port *p)
 {
-	return rcu_dereference_rtnl(p->vlan_info);
+	return rcu_dereference_protected(p->vlan_info,
+					 rcu_read_lock_held() ||
+					 lockdep_rtnl_is_held());
 }
 
 /* Since bridge now depends on 8021Q module, but the time bridge sees the

  reply	other threads:[~2015-05-04 18:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 17:07 Suspicious RCU usage in bridge with Linux v4.0-9362-g1fc149933fd4 Josh Boyer
2015-04-23 17:35 ` Sudeep Holla
2015-04-23 22:53 ` Cong Wang
2015-05-04 13:39 ` Dominick Grift
2015-05-04 18:45   ` Cong Wang [this message]
2015-05-04 20:27     ` Stephen Hemminger
2015-05-04 21:35       ` Cong Wang
2015-05-11 13:15         ` Dominick Grift
2015-05-11 14:53           ` Eric Dumazet
2015-05-11 17:42             ` Dominick Grift
2015-05-12  0:13             ` poma
2015-05-12  0:37               ` Eric Dumazet
2015-05-12  1:33                 ` poma
2015-05-12 18:27             ` Dominick Grift
2015-05-21 19:22               ` Josh Boyer
2015-05-21 20:06                 ` Eric Dumazet
2015-05-05  2:32       ` Vlad Yasevich
2015-05-04 20:49     ` Eric Dumazet
2015-05-04 21:38       ` Cong Wang
2015-05-04 22:06         ` Eric Dumazet
2015-05-04 22:17           ` Cong Wang
2015-05-04 22:29             ` Eric Dumazet
2015-05-04 22:44               ` Cong Wang
2015-05-04 23:00                 ` Eric Dumazet
2015-05-04 23:22                   ` David Miller
2015-05-05  8:33     ` Dominick Grift
2015-05-21 20:28 ` [PATCH net] bridge: fix lockdep splat Eric Dumazet

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=CAHA+R7PAzzz+CZfnOoweBdeLY8tRkr2bSDEpQgdtEKUeaZbWpQ@mail.gmail.com \
    --to=cwang@twopensource.com \
    --cc=dac.override@gmail.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).