bonding: fix error check in sysfs creation
authorJay Vosburgh <fubar@us.ibm.com>
Sat, 20 Jan 2007 02:15:38 +0000 (18:15 -0800)
committerJeff Garzik <jeff@garzik.org>
Mon, 5 Feb 2007 21:58:47 +0000 (16:58 -0500)
The existing code did not correctly handle failures to create
the per-interface sysfs group for bonding.

Modified code to notice errors, and correctly unwind.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/bonding/bond_main.c

index 07b9d1f65b6628c52dbc08e5306593928c181706..d3801a00d3d5152f6009024bb41248db950dc43f 100644 (file)
@@ -4756,14 +4756,19 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
 
        rtnl_unlock(); /* allows sysfs registration of net device */
        res = bond_create_sysfs_entry(bond_dev->priv);
-       goto done;
+       if (res < 0) {
+               rtnl_lock();
+               goto out_bond;
+       }
+
+       return 0;
+
 out_bond:
        bond_deinit(bond_dev);
 out_netdev:
        free_netdev(bond_dev);
 out_rtnl:
        rtnl_unlock();
-done:
        return res;
 }