Commit 9d34d1a2 authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

bonding: fix panic if initialization fails

If module initialisation failed (e.g. because the bonding sysfs entry
cannot be created), kernel panics:
 IP: [<ffffffff8024910a>] destroy_workqueue+0x2d/0x146
Call Trace:
 [<ffffffff808268c4>] bond_destructor+0x28/0x78
 [<ffffffff80b64471>] netdev_run_todo+0x231/0x25a
 [<ffffffff80b6dbcd>] rtnl_unlock+0x9/0xb
 [<ffffffff81567907>] bonding_init+0x83e/0x84a

Remove the calls to bond_work_cancel_all() and destroy_workqueue();
both are also called/scheduled via bond_free_all().

bond_destroy_sysfs is unecessary because the sysfs entry has
not been created in the error case.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be8be9ec
...@@ -5181,7 +5181,6 @@ static int __init bonding_init(void) ...@@ -5181,7 +5181,6 @@ static int __init bonding_init(void)
{ {
int i; int i;
int res; int res;
struct bonding *bond;
printk(KERN_INFO "%s", version); printk(KERN_INFO "%s", version);
...@@ -5212,13 +5211,6 @@ static int __init bonding_init(void) ...@@ -5212,13 +5211,6 @@ static int __init bonding_init(void)
goto out; goto out;
err: err:
list_for_each_entry(bond, &bond_dev_list, bond_list) {
bond_work_cancel_all(bond);
destroy_workqueue(bond->wq);
}
bond_destroy_sysfs();
rtnl_lock(); rtnl_lock();
bond_free_all(); bond_free_all();
rtnl_unlock(); rtnl_unlock();
......
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