All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: bgmac: Drop free_netdev() from bgmac_enet_remove()
@ 2022-11-09 15:01 Wei Yongjun
  2022-11-12  5:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2022-11-09 15:01 UTC (permalink / raw)
  To: Rafał Miłecki, Broadcom internal kernel review list,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli
  Cc: Wei Yongjun, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

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>

diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 5fb3af5670ec..3038386a5afd 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -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);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: bgmac: Drop free_netdev() from bgmac_enet_remove()
  2022-11-09 15:01 [PATCH net] net: bgmac: Drop free_netdev() from bgmac_enet_remove() Wei Yongjun
@ 2022-11-12  5:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-12  5:10 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: rafal, bcm-kernel-feedback-list, davem, edumazet, kuba, pabeni,
	f.fainelli, weiyongjun1, netdev

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  9 Nov 2022 15:01:36 +0000 you wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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>

Here is the summary with links:
  - [net] net: bgmac: Drop free_netdev() from bgmac_enet_remove()
    https://git.kernel.org/netdev/net/c/6f928ab8ee9b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-12  5:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-09 15:01 [PATCH net] net: bgmac: Drop free_netdev() from bgmac_enet_remove() Wei Yongjun
2022-11-12  5:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.