]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:34 +0000 (11:56 +0200)
commitd04c370c7eca2c8d49f80cd390d670563691a903
treef24e4e5aaf8302014f6bd75ed8ff03109b0318d2
parent3777506e294cce3dca062e81c3a7b1ffaec8f811
wifi: mt76: fix potential memory leak in mt76_wmac_probe()

[ Upstream commit 42754b7de2b1a2cf116c5e3f1e8e78392f4ed700 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7603/soc.c