net: dsa: tag_8021q: avoid leaking ctx on dsa_tag_8021q_register() error path
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 9 Dec 2022 23:52:42 +0000 (01:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:21 +0000 (13:14 +0100)
commit09f30f394e832ed09859b6a80fdd20668a9104ff
tree50da140176c23fc02c3c7f519b4c4920b8ed4e85
parent86664b865239a581181c26fd9e70512966b9a31d
net: dsa: tag_8021q: avoid leaking ctx on dsa_tag_8021q_register() error path

[ Upstream commit e095493091e850d5292ad01d8fbf5cde1d89ac53 ]

If dsa_tag_8021q_setup() fails, for example due to the inability of the
device to install a VLAN, the tag_8021q context of the switch will leak.
Make sure it is freed on the error path.

Fixes: 328621f6131f ("net: dsa: tag_8021q: absorb dsa_8021q_setup into dsa_tag_8021q_{,un}register")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20221209235242.480344-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/dsa/tag_8021q.c