Skip to content

Commit

Permalink
mt76: mt7915: fix possible memory leak in mt7915_mcu_add_sta
Browse files Browse the repository at this point in the history
[ Upstream commit a43736c ]

Free allocated skb in mt7915_mcu_add_sta routine in case of failures.

Fixes: 89bbd37 ("mt76: mt7915: rework starec TLV tags")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
LorenzoBianconi authored and gregkh committed Apr 8, 2022
1 parent 5c2ef67 commit b334a24
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
Expand Up @@ -2399,8 +2399,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
}

ret = mt7915_mcu_sta_wtbl_tlv(dev, skb, vif, sta);
if (ret)
if (ret) {
dev_kfree_skb(skb);
return ret;
}

if (sta && sta->ht_cap.ht_supported) {
/* starec amsdu */
Expand All @@ -2414,8 +2416,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
}

ret = mt7915_mcu_add_group(dev, vif, sta);
if (ret)
if (ret) {
dev_kfree_skb(skb);
return ret;
}
out:
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD(STA_REC_UPDATE), true);
Expand Down

0 comments on commit b334a24

Please sign in to comment.