2010-07-07 11:12:45 +00:00
|
|
|
From: jbeulich@novell.com
|
|
|
|
Subject: Module use count must be updated as bridges are created/destroyed
|
|
|
|
Patch-mainline: unknown
|
|
|
|
References: 267651
|
|
|
|
|
|
|
|
Otherwise 'modprobe -r' on a module having a dependency on bridge will
|
|
|
|
implicitly unload bridge, bringing down all connectivity that was using
|
|
|
|
bridges.
|
|
|
|
|
|
|
|
---
|
|
|
|
net/bridge/br_if.c | 9 +++++++++
|
|
|
|
1 file changed, 9 insertions(+)
|
|
|
|
|
|
|
|
--- a/net/bridge/br_if.c
|
|
|
|
+++ b/net/bridge/br_if.c
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -291,6 +291,11 @@ int br_add_bridge(struct net *net, const
|
2010-07-07 11:12:45 +00:00
|
|
|
if (!dev)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
+ if (!try_module_get(THIS_MODULE)) {
|
|
|
|
+ free_netdev(dev);
|
|
|
|
+ return -ENOENT;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
rtnl_lock();
|
|
|
|
if (strchr(dev->name, '%')) {
|
|
|
|
ret = dev_alloc_name(dev, dev->name);
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -309,6 +314,8 @@ int br_add_bridge(struct net *net, const
|
2010-07-07 11:12:45 +00:00
|
|
|
unregister_netdevice(dev);
|
|
|
|
out:
|
|
|
|
rtnl_unlock();
|
|
|
|
+ if (ret)
|
|
|
|
+ module_put(THIS_MODULE);
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
out_free:
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -340,6 +347,8 @@ int br_del_bridge(struct net *net, const
|
2010-07-07 11:12:45 +00:00
|
|
|
del_br(netdev_priv(dev), NULL);
|
|
|
|
|
|
|
|
rtnl_unlock();
|
|
|
|
+ if (ret == 0)
|
|
|
|
+ module_put(THIS_MODULE);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|