From: Patrick McHardy Date: Sat, 27 Feb 2010 10:52:05 +0000 (-0800) Subject: bonding: fix device leak on error in bond_create() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8d6184e4881b423522136aeb3ec1cbd9c35e8813;p=linux.git bonding: fix device leak on error in bond_create() When the register_netdevice() call fails, the newly allocated device is not freed. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 1787e3c865739..430c02267d7e9 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -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();