]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 12:58:58 +0000 (13:58 +0100)
commit1f8b4552e300762727318a1a8a78e4dc8ffe5138
tree84fa875a3d4b82a59b5c81de238561b1decd105f
parent51d3a640509a8c3d1ba6efd1b42d3344d4ef5b75
net: vlan: avoid leaks on register_vlan_dev() failures

[ Upstream commit 55b7ab1178cbf41f979ff83236d3321ad35ed2ad ]

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

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

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

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