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: https://git.stricted.de/?a=commitdiff_plain;h=8d6184e4881b423522136aeb3ec1cbd9c35e8813;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.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 1787e3c86573..430c02267d7e 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();