Skip to content

Commit

Permalink
[BOND]: Fix bond_init() error path handling.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fmalita authored and davem330 committed Sep 18, 2005
1 parent 88f964d commit 40abc27
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5039,6 +5039,14 @@ static int __init bonding_init(void)
return 0;

out_err:
/*
* rtnl_unlock() will run netdev_run_todo(), putting the
* thus-far-registered bonding devices into a state which
* unregigister_netdevice() will accept
*/
rtnl_unlock();
rtnl_lock();

/* free and unregister all bonds that were successfully added */
bond_free_all();

Expand Down

0 comments on commit 40abc27

Please sign in to comment.