bonding: fix device leak on error in bond_create()
authorPatrick McHardy <kaber@trash.net>
Sat, 27 Feb 2010 10:52:05 +0000 (02:52 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Feb 2010 10:52:05 +0000 (02:52 -0800)
When the register_netdevice() call fails, the newly allocated device is
not freed.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c

index 1787e3c8657390ef6180d6d6c218ce679f9465b7..430c02267d7e9ec26d3c8b59922d919fc5fedb97 100644 (file)
@@ -4946,6 +4946,8 @@ int bond_create(struct net *net, const char *name)
        }
 
        res = register_netdevice(bond_dev);
+       if (res < 0)
+               goto out_netdev;
 
 out:
        rtnl_unlock();