* [PATCH] wifi: mt76: fix potential memory leak in mt76_wmac_probe()
@ 2025-07-09 14:55 Abdun Nihaal
2025-07-10 5:47 ` Jiri Slaby
0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2025-07-09 14:55 UTC (permalink / raw)
To: nbd
Cc: Abdun Nihaal, lorenzo, ryder.lee, shayne.chen, sean.wang,
matthias.bgg, angelogioacchino.delregno, kvalo, toke,
jeff.johnson, jirislaby, u.kleine-koenig, linux-wireless,
linux-kernel, linux-arm-kernel, linux-mediatek
In mt76_wmac_probe(), when the mt76_alloc_device() call succeeds, memory
is allocated for both struct ieee80211_hw and a workqueue. However, on
the error path, the workqueue is not freed. Fix that by calling
mt76_free_device() on the error path.
Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
---
This patch is compile tested only. Not tested on real hardware.
drivers/net/wireless/mediatek/mt76/mt7603/soc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/soc.c b/drivers/net/wireless/mediatek/mt76/mt7603/soc.c
index 08590aa68356..1dd372372048 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/soc.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/soc.c
@@ -48,7 +48,7 @@ mt76_wmac_probe(struct platform_device *pdev)
return 0;
error:
- ieee80211_free_hw(mt76_hw(dev));
+ mt76_free_device(mdev);
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: mt76: fix potential memory leak in mt76_wmac_probe()
2025-07-09 14:55 [PATCH] wifi: mt76: fix potential memory leak in mt76_wmac_probe() Abdun Nihaal
@ 2025-07-10 5:47 ` Jiri Slaby
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2025-07-10 5:47 UTC (permalink / raw)
To: Abdun Nihaal, nbd
Cc: lorenzo, ryder.lee, shayne.chen, sean.wang, matthias.bgg,
angelogioacchino.delregno, kvalo, toke, jeff.johnson,
u.kleine-koenig, linux-wireless, linux-kernel, linux-arm-kernel,
linux-mediatek
On 09. 07. 25, 16:55, Abdun Nihaal wrote:
> In mt76_wmac_probe(), when the mt76_alloc_device() call succeeds, memory
> is allocated for both struct ieee80211_hw and a workqueue. However, on
> the error path, the workqueue is not freed. Fix that by calling
> mt76_free_device() on the error path.
>
> Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
> Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
I am not sure, why I am CCed, but makes sense anyway (free the one
obtained by alloc_ordered_workqueue() in mt76_alloc_device()):
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
--
js
suse labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-10 5:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 14:55 [PATCH] wifi: mt76: fix potential memory leak in mt76_wmac_probe() Abdun Nihaal
2025-07-10 5:47 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).