mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-14 16:23:51 +08:00
net: vlan: avoid leaks on register_vlan_dev() failures
VLAN checks for NETREG_UNINITIALIZED to distinguish between registration failure and unregistration in progress. Since commitcb626bf566
("net-sysfs: Fix reference count leak") registration failure may, however, result in NETREG_UNREGISTERED as well as NETREG_UNINITIALIZED. This fix is similer tocebb69754f
("rtnetlink: Fix memory(net_device) leak when ->newlink fails") Fixes:cb626bf566
("net-sysfs: Fix reference count leak") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cf07206971
commit
55b7ab1178
@ -284,7 +284,8 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
|
||||
return 0;
|
||||
|
||||
out_free_newdev:
|
||||
if (new_dev->reg_state == NETREG_UNINITIALIZED)
|
||||
if (new_dev->reg_state == NETREG_UNINITIALIZED ||
|
||||
new_dev->reg_state == NETREG_UNREGISTERED)
|
||||
free_netdev(new_dev);
|
||||
return err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user