Patchwork Bridge: Removed unwanted check and improper usage of bridge locks

login
register
mail settings
Submitter Sasikanth V
Date March 29, 2011, 6:24 p.m.
Message ID <1301423072-28093-1-git-send-email-sasikanth.v19@gmail.com>
Download mbox | patch
Permalink /patch/88821/
State Rejected
Delegated to: David Miller
Headers show

Comments

Sasikanth V - March 29, 2011, 6:24 p.m.
Signed-off-by: Sasikanth V <sasikanth.v19@gmail.com>
---
 net/bridge/br_device.c    |    5 ++++-
 net/bridge/br_stp_if.c    |    2 --
 net/bridge/br_stp_timer.c |    3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)
Stephen Hemminger - March 31, 2011, 3:36 p.m.
On Tue, 29 Mar 2011 23:54:32 +0530
Sasikanth V <sasikanth.v19@gmail.com> wrote:


I don't think this is needed because br_dev_open is already covered
by the netlink mutex RTNL
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 21e5901..6cc612b 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -80,10 +80,13 @@  static int br_dev_open(struct net_device *dev)
 
 	netif_carrier_off(dev);
 
-	br_features_recompute(br);
 	netif_start_queue(dev);
+
+	spin_lock_bh(&br->lock);
+	br_features_recompute(br);
 	br_stp_enable_bridge(br);
 	br_multicast_open(br);
+	spin_unlock_bh(&br->lock);
 
 	return 0;
 }
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 5593f5a..472d8b2 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -44,7 +44,6 @@  void br_stp_enable_bridge(struct net_bridge *br)
 {
 	struct net_bridge_port *p;
 
-	spin_lock_bh(&br->lock);
 	mod_timer(&br->hello_timer, jiffies + br->hello_time);
 	mod_timer(&br->gc_timer, jiffies + HZ/10);
 
@@ -55,7 +54,6 @@  void br_stp_enable_bridge(struct net_bridge *br)
 			br_stp_enable_port(p);
 
 	}
-	spin_unlock_bh(&br->lock);
 }
 
 /* NO locks held */
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index 3e96514..18244b2 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -65,8 +65,6 @@  static void br_message_age_timer_expired(unsigned long arg)
 	 * check is redundant. I'm leaving it in for now, though.
 	 */
 	spin_lock(&br->lock);
-	if (p->state == BR_STATE_DISABLED)
-		goto unlock;
 	was_root = br_is_root_bridge(br);
 
 	br_become_designated_port(p);
@@ -74,7 +72,6 @@  static void br_message_age_timer_expired(unsigned long arg)
 	br_port_state_selection(br);
 	if (br_is_root_bridge(br) && !was_root)
 		br_become_root_bridge(br);
- unlock:
 	spin_unlock(&br->lock);
 }