]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: bgmac: Drop free_netdev() from bgmac_enet_remove()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 9 Nov 2022 15:01:36 +0000 (15:01 +0000)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 12:59:28 +0000 (13:59 +0100)
[ Upstream commit 6f928ab8ee9bfbcb0e631c47ea8a16c3d5116ff1 ]

netdev is allocated in bgmac_alloc() with devm_alloc_etherdev() and will
be auto released in ->remove and ->probe failure path. Using free_netdev()
in bgmac_enet_remove() leads to double free.

Fixes: 34a5102c3235 ("net: bgmac: allocate struct bgmac just once & don't copy it")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20221109150136.2991171-1-weiyongjun@huaweicloud.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0ee6455c9cfa6af2dddc2701673ccaf5fb0bd7d2)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
drivers/net/ethernet/broadcom/bgmac.c

index 6e8bc6726031146c4f6f7e78e1a3fd42bab457e8..fa2a43d465db738f3f71a11b702ab464b03ada2b 100644 (file)
@@ -1568,7 +1568,6 @@ void bgmac_enet_remove(struct bgmac *bgmac)
        phy_disconnect(bgmac->net_dev->phydev);
        netif_napi_del(&bgmac->napi);
        bgmac_dma_free(bgmac);
-       free_netdev(bgmac->net_dev);
 }
 EXPORT_SYMBOL_GPL(bgmac_enet_remove);