Skip to content

Commit

Permalink
bonding: Do not call free_netdev for already registered device.
Browse files Browse the repository at this point in the history
If the call to bond_create_sysfs_entry in bond_create fails, the
proper rollback is to call unregister_netdevice, not free_netdev.
Otherwise - kernel BUG at net/core/dev.c:4057!

Checked with artificial failures injected into bond_create_sysfs_entry.

Pavel's original patch modified by Jay Vosburgh to move code around
for clarity (remove goto-hopping within the unwind block).

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Pavel Emelyanov authored and Jeff Garzik committed May 6, 2008
1 parent 9d1045a commit 822973b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4936,7 +4936,9 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
if (res < 0) {
rtnl_lock();
down_write(&bonding_rwsem);
goto out_bond;
bond_deinit(bond_dev);
unregister_netdevice(bond_dev);
goto out_rtnl;
}

return 0;
Expand Down

0 comments on commit 822973b

Please sign in to comment.