Commit 367c89b5 authored by Stephen Hemminger's avatar Stephen Hemminger

[BRIDGE]: Fix deadlock on device removal.

Fix a deadlock where deleting a device call br_del_if with lock held.
br_del_if doesn't want to be called under lock anymore.
parent 39b81cce
...@@ -38,30 +38,35 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v ...@@ -38,30 +38,35 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
br = p->br; br = p->br;
spin_lock_bh(&br->lock); switch (event) {
switch (event)
{
case NETDEV_CHANGEADDR: case NETDEV_CHANGEADDR:
spin_lock_bh(&br->lock);
br_fdb_changeaddr(p, dev->dev_addr); br_fdb_changeaddr(p, dev->dev_addr);
if (br->dev->flags & IFF_UP) if (br->dev->flags & IFF_UP)
br_stp_recalculate_bridge_id(br); br_stp_recalculate_bridge_id(br);
spin_unlock_bh(&br->lock);
break; break;
case NETDEV_DOWN: case NETDEV_DOWN:
if (br->dev->flags & IFF_UP) if (br->dev->flags & IFF_UP) {
spin_lock_bh(&br->lock);
br_stp_disable_port(p); br_stp_disable_port(p);
spin_unlock_bh(&br->lock);
}
break; break;
case NETDEV_UP: case NETDEV_UP:
if (br->dev->flags & IFF_UP) if (br->dev->flags & IFF_UP) {
spin_lock_bh(&br->lock);
br_stp_enable_port(p); br_stp_enable_port(p);
spin_unlock_bh(&br->lock);
}
break; break;
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
br_del_if(br, dev); br_del_if(br, dev);
break; break;
} }
spin_unlock_bh(&br->lock);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
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