diff options
author | Florin Malita <fmalita@gmail.com> | 2005-09-18 03:24:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-18 03:24:12 -0400 |
commit | 40abc27066c49b2c13c817154d438431b0303b96 (patch) | |
tree | 0e5b000311e1729892c4595c0dbe106b987d577e | |
parent | 88f964db6ef728982734356bf4c406270ea29c1d (diff) |
[BOND]: Fix bond_init() error path handling.
From: Florin Malita <fmalita@gmail.com>
bond_init() is not releasing rtnl_sem after register_netdevice() and before
calling unregister_netdevice() (from bond_free_all()) in the exception
path. As the device registration is not completed (dev->reg_state ==
NETREG_REGISTERING), the call to unregister_netdevice() triggers
BUG_ON(dev->reg_state != NETREG_REGISTERED).
Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bonding/bond_main.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f8dedb623dc0..90449a0f2a6c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -5039,6 +5039,14 @@ static int __init bonding_init(void) | |||
5039 | return 0; | 5039 | return 0; |
5040 | 5040 | ||
5041 | out_err: | 5041 | out_err: |
5042 | /* | ||
5043 | * rtnl_unlock() will run netdev_run_todo(), putting the | ||
5044 | * thus-far-registered bonding devices into a state which | ||
5045 | * unregigister_netdevice() will accept | ||
5046 | */ | ||
5047 | rtnl_unlock(); | ||
5048 | rtnl_lock(); | ||
5049 | |||
5042 | /* free and unregister all bonds that were successfully added */ | 5050 | /* free and unregister all bonds that were successfully added */ |
5043 | bond_free_all(); | 5051 | bond_free_all(); |
5044 | 5052 | ||