]> git.baikalelectronics.ru Git - kernel.git/commit
net: vlan: avoid leaks on register_vlan_dev() failures
authorJakub Kicinski <kuba@kernel.org>
Thu, 31 Dec 2020 03:40:27 +0000 (19:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Jan 2021 00:25:31 +0000 (16:25 -0800)
commit341234452014f5108226e30642db2625aaed5f32
tree416fc729fda3813f01f22c481acddb981df1b015
parentea58445a254b96222c3b06e7eb052ad3336fb51c
net: vlan: avoid leaks on register_vlan_dev() failures

VLAN checks for NETREG_UNINITIALIZED to distinguish between
registration failure and unregistration in progress.

Since commit 9682f0427247 ("net-sysfs: Fix reference count leak")
registration failure may, however, result in NETREG_UNREGISTERED
as well as NETREG_UNINITIALIZED.

This fix is similer to 4c9b76072bf5 ("rtnetlink: Fix
memory(net_device) leak when ->newlink fails")

Fixes: 9682f0427247 ("net-sysfs: Fix reference count leak")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/8021q/vlan.c