Skip to content

Commit 53d1548

Browse files
GoodLuck612nbd168
authored andcommitted
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: 99c457d ("mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops") Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20251113062415.103611-1-zilin@seu.edu.cn Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent 066f417 commit 53d1548

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • drivers/net/wireless/mediatek/mt76/mt7615

drivers/net/wireless/mediatek/mt76/mt7615/mcu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,10 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
874874
wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid,
875875
WTBL_RESET_AND_SET, NULL,
876876
&wskb);
877-
if (IS_ERR(wtbl_hdr))
877+
if (IS_ERR(wtbl_hdr)) {
878+
dev_kfree_skb(sskb);
878879
return PTR_ERR(wtbl_hdr);
880+
}
879881

880882
if (enable) {
881883
mt76_connac_mcu_wtbl_generic_tlv(&dev->mt76, wskb, vif, sta,

0 commit comments

Comments
 (0)