wifi: mt76: fix potential memory leak in mt76_wmac_probe()
Subsystems (2)
PATCH 1/1 wifi: mt76: fix potential memory leak in mt76_wmac_probe()
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.
---
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(-)
drivers/net/wireless/mediatek/mt76/mt7603/soc.c +1 -1
@@ -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; }
Signature · 1 line
2.43.0
Quoted 7 lines · Abdun Nihaal
In
mt76_wmac_probe(), when themt76_alloc_device()call succeeds, memory is allocated for both structieee80211_hwand a workqueue. However, on the error path, the workqueue is not freed. Fix that by callingmt76_free_device()on the error path.Fixes c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")Signed-off-by Abdun Nihaal <[email protected]>
I am not sure, why I am CCed, but makes sense anyway (free the one obtained by alloc_ordered_workqueue() in mt76_alloc_device()):
Signature · 2 lines
js suse labs