[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <481736AA.9050805@openvz.org>
Date: Tue, 29 Apr 2008 18:54:34 +0400
From: Pavel Emelyanov <xemul@...nvz.org>
To: unlisted-recipients:; (no To-header on input)
CC: Jay Vosburgh <fubar@...ibm.com>,
David Miller <davem@...emloft.net>,
bonding-devel@...ts.sourceforge.net,
Linux Netdev List <netdev@...r.kernel.org>
Subject: [PATCH 1/8][BONDING]: Do not call free_netdev for already registered
device.
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.
Signed-off-by: Pavel Emelyanov <xemul@...nvz.org>
---
drivers/net/bonding/bond_main.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6e91b4b..36121b6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4936,14 +4936,18 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
up_write(&bonding_rwsem);
rtnl_unlock(); /* allows sysfs registration of net device */
res = bond_create_sysfs_entry(bond_dev->priv);
- if (res < 0) {
- rtnl_lock();
- down_write(&bonding_rwsem);
- goto out_bond;
- }
+ if (res < 0)
+ goto out_unreg;
return 0;
+out_unreg:
+ rtnl_lock();
+ down_write(&bonding_rwsem);
+ bond_deinit(bond_dev);
+ unregister_netdevice(bond_dev);
+ goto out_rtnl;
+
out_bond:
bond_deinit(bond_dev);
out_netdev:
--
1.5.3.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists