From 45e74e6561f0da79a417be5424d2c1bf26ae79ba Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Sat, 27 Feb 2010 02:52:05 -0800 Subject: bonding: fix device leak on error in bond_create() [ Upstream commit 8d6184e4881b423522136aeb3ec1cbd9c35e8813 ] When the register_netdevice() call fails, the newly allocated device is not freed. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index efa0e41bf3ec..1f800aeac244 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4935,6 +4935,8 @@ int bond_create(struct net *net, const char *name) } res = register_netdevice(bond_dev); + if (res < 0) + goto out_netdev; out: rtnl_unlock(); -- cgit v1.2.2