]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: fix potential memory leak in mt76_wmac_probe()
authorAbdun Nihaal <abdun.nihaal@gmail.com>
Wed, 9 Jul 2025 14:55:30 +0000 (20:25 +0530)
committerFelix Fietkau <nbd@nbd.name>
Mon, 15 Sep 2025 07:47:38 +0000 (09:47 +0200)
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>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://patch.msgid.link/20250709145532.41246-1-abdun.nihaal@gmail.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7603/soc.c

index 08590aa68356f7b7dc10e4d2059f3f8759593e40..1dd3723720480790d16efbd4a1c7d2547b823bd2 100644 (file)
@@ -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;
 }