Commit 6e86b890 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[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=6156Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 501f74f2
...@@ -81,26 +81,27 @@ static void port_carrier_check(void *arg) ...@@ -81,26 +81,27 @@ static void port_carrier_check(void *arg)
{ {
struct net_device *dev = arg; struct net_device *dev = arg;
struct net_bridge_port *p; struct net_bridge_port *p;
struct net_bridge *br;
rtnl_lock(); rtnl_lock();
p = dev->br_port; p = dev->br_port;
if (!p) if (!p)
goto done; goto done;
br = p->br;
if (netif_carrier_ok(p->dev)) {
u32 cost = port_cost(p->dev); if (netif_carrier_ok(dev))
p->path_cost = port_cost(dev);
spin_lock_bh(&p->br->lock);
if (p->state == BR_STATE_DISABLED) { if (br->dev->flags & IFF_UP) {
p->path_cost = cost; spin_lock_bh(&br->lock);
br_stp_enable_port(p); if (netif_carrier_ok(dev)) {
if (p->state == BR_STATE_DISABLED)
br_stp_enable_port(p);
} else {
if (p->state != BR_STATE_DISABLED)
br_stp_disable_port(p);
} }
spin_unlock_bh(&p->br->lock); spin_unlock_bh(&br->lock);
} else {
spin_lock_bh(&p->br->lock);
if (p->state != BR_STATE_DISABLED)
br_stp_disable_port(p);
spin_unlock_bh(&p->br->lock);
} }
done: done:
rtnl_unlock(); rtnl_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment