net: ag71xx: Fix a potential double free in error handling paths
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 26 Dec 2021 17:51:44 +0000 (18:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jan 2022 11:42:35 +0000 (12:42 +0100)
commitc903a963b7e60a4016fdeb307047465fbc67feb1
treeb7fb66fbbd0e20c3cba166c10c08f3ffaec50aa1
parent0d82faa347a13aaf7e583c20fe2d1a1d4f3a8f08
net: ag71xx: Fix a potential double free in error handling paths

[ Upstream commit 1cd5384c88af5b59bf9f3b6c1a151bc14b88c2cd ]

'ndev' is a managed resource allocated with devm_alloc_etherdev(), so there
is no need to call free_netdev() explicitly or there will be a double
free().

Simplify all error handling paths accordingly.

Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/atheros/ag71xx.c