]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
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)
committerAndrea Righi <andrea.righi@canonical.com>
Fri, 21 Jan 2022 14:49:19 +0000 (15:49 +0100)
commit6a5a5c9f4127d2cc3d6571efacb42f93d5c71dca
tree2f02b78e81303f6d231d073fa05ec59e587d7413
parent2200ad7b8a45efeb4c910782a463e9aa119eac2e
net: ag71xx: Fix a potential double free in error handling paths

BugLink: https://bugs.launchpad.net/bugs/1956926
[ 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>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
drivers/net/ethernet/atheros/ag71xx.c