[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRWF9QJuwGaDlUvT@lore-desk>
Date: Thu, 13 Nov 2025 08:17:09 +0100
From: Lorenzo Bianconi <lorenzo@...nel.org>
To: Zilin Guan <zilin@....edu.cn>
Cc: nbd@....name, ryder.lee@...iatek.com, shayne.chen@...iatek.com,
sean.wang@...iatek.com, matthias.bgg@...il.com,
angelogioacchino.delregno@...labora.com,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, jianhao.xu@....edu.cn
Subject: Re: [PATCH net] mt76: mt7615: Fix memory leak in
mt7615_mcu_wtbl_sta_add()
> In mt7615_mcu_wtbl_sta_add(), an skb sskb is allocated. If the
> subsequent call to mt76_connac_mcu_alloc_wtbl_req() fails, the function
> returns an error without freeing sskb, leading to a memory leak.
>
> Fix this by calling dev_kfree_skb() on sskb in the error handling path
> to ensure it is properly released.
>
> Fixes: 99c457d902cf9 ("mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops")
> Signed-off-by: Zilin Guan <zilin@....edu.cn>
> ---
> drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 4064e193d4de..08ee2e861c4e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -874,8 +874,10 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
> wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid,
> WTBL_RESET_AND_SET, NULL,
> &wskb);
> - if (IS_ERR(wtbl_hdr))
> + if (IS_ERR(wtbl_hdr)) {
> + dev_kfree_skb(sskb);
Hi Zilin,
I can't see how this is useful since if mt76_connac_mcu_alloc_wtbl_req returns
an error, wskb will not be allocated.
Regards,
Lorenzo
> return PTR_ERR(wtbl_hdr);
> + }
>
> if (enable) {
> mt76_connac_mcu_wtbl_generic_tlv(&dev->mt76, wskb, vif, sta,
> --
> 2.34.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists