aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-10-06 07:19:41 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-18 23:24:16 -0400
commit1ce5cce895309862d2c35d922816adebe094fe4a (patch)
tree15e92f7f8f7a78843ec797bcd4b432979be111a7 /net/bridge/br_if.c
parentae2a4583154a5b985ed4a81c6259c55bafe6d810 (diff)
bridge: fix hang on removal of bridge via netlink
Need to cleanup bridge device timers and ports when being bridge device is being removed via netlink. This fixes the problem of observed when doing: ip link add br0 type bridge ip link set dev eth1 master br0 ip link set br0 up ip link del br0 which would cause br0 to hang in unregister_netdev because of leftover reference count. Reported-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index e73815456adf..1d420f64ff27 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -161,9 +161,10 @@ static void del_nbp(struct net_bridge_port *p)
161 call_rcu(&p->rcu, destroy_nbp_rcu); 161 call_rcu(&p->rcu, destroy_nbp_rcu);
162} 162}
163 163
164/* called with RTNL */ 164/* Delete bridge device */
165static void del_br(struct net_bridge *br, struct list_head *head) 165void br_dev_delete(struct net_device *dev, struct list_head *head)
166{ 166{
167 struct net_bridge *br = netdev_priv(dev);
167 struct net_bridge_port *p, *n; 168 struct net_bridge_port *p, *n;
168 169
169 list_for_each_entry_safe(p, n, &br->port_list, list) { 170 list_for_each_entry_safe(p, n, &br->port_list, list) {
@@ -268,7 +269,7 @@ int br_del_bridge(struct net *net, const char *name)
268 } 269 }
269 270
270 else 271 else
271 del_br(netdev_priv(dev), NULL); 272 br_dev_delete(dev, NULL);
272 273
273 rtnl_unlock(); 274 rtnl_unlock();
274 return ret; 275 return ret;
@@ -449,7 +450,7 @@ void __net_exit br_net_exit(struct net *net)
449 rtnl_lock(); 450 rtnl_lock();
450 for_each_netdev(net, dev) 451 for_each_netdev(net, dev)
451 if (dev->priv_flags & IFF_EBRIDGE) 452 if (dev->priv_flags & IFF_EBRIDGE)
452 del_br(netdev_priv(dev), &list); 453 br_dev_delete(dev, &list);
453 454
454 unregister_netdevice_many(&list); 455 unregister_netdevice_many(&list);
455 rtnl_unlock(); 456 rtnl_unlock();