aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-03-03 20:14:51 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-05 00:06:19 -0500
commit6e86b89084a60355f0e1fb876ca0cfbca62ee85c (patch)
tree076b621fad864de984661a9a15bd526bc068776b /net/bridge
parent501f74f29498543c27f4f9697f5c1e980dd2de0d (diff)
[BRIDGE]: fix crash in STP
Bridge would crash because of uninitailized timer if STP is used and device was inserted into a bridge before bridge was up. This got introduced when the delayed port checking was added. Fix is to not enable STP on port unless bridge is up. Bugzilla: http://bugzilla.kernel.org/show_bug.cgi?id=6140 Dup: http://bugzilla.kernel.org/show_bug.cgi?id=6156 Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_if.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 7fa3a5a9971f..8b38c839d539 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -81,26 +81,27 @@ static void port_carrier_check(void *arg)
81{ 81{
82 struct net_device *dev = arg; 82 struct net_device *dev = arg;
83 struct net_bridge_port *p; 83 struct net_bridge_port *p;
84 struct net_bridge *br;
84 85
85 rtnl_lock(); 86 rtnl_lock();
86 p = dev->br_port; 87 p = dev->br_port;
87 if (!p) 88 if (!p)
88 goto done; 89 goto done;
89 90 br = p->br;
90 if (netif_carrier_ok(p->dev)) { 91
91 u32 cost = port_cost(p->dev); 92 if (netif_carrier_ok(dev))
92 93 p->path_cost = port_cost(dev);
93 spin_lock_bh(&p->br->lock); 94
94 if (p->state == BR_STATE_DISABLED) { 95 if (br->dev->flags & IFF_UP) {
95 p->path_cost = cost; 96 spin_lock_bh(&br->lock);
96 br_stp_enable_port(p); 97 if (netif_carrier_ok(dev)) {
98 if (p->state == BR_STATE_DISABLED)
99 br_stp_enable_port(p);
100 } else {
101 if (p->state != BR_STATE_DISABLED)
102 br_stp_disable_port(p);
97 } 103 }
98 spin_unlock_bh(&p->br->lock); 104 spin_unlock_bh(&br->lock);
99 } else {
100 spin_lock_bh(&p->br->lock);
101 if (p->state != BR_STATE_DISABLED)
102 br_stp_disable_port(p);
103 spin_unlock_bh(&p->br->lock);
104 } 105 }
105done: 106done:
106 rtnl_unlock(); 107 rtnl_unlock();