Commit 53d15486 authored by Zilin Guan's avatar Zilin Guan Committed by Felix Fietkau
Browse files

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: 99c457d9 ("mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops")
Signed-off-by: default avatarZilin Guan <zilin@seu.edu.cn>
Acked-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20251113062415.103611-1-zilin@seu.edu.cn


Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 066f417b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
		return PTR_ERR(wtbl_hdr);
	}

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