Skip to contentSkip to conversation

wifi: mt76: mt7915: Release wiphy mutex if WCID allocation fails.

PATCH New Rory Little 1 participant 1 message Oct 26, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mt76: mt7915: Release wiphy mutex if WCID allocation fails.

This fixes a lockup observed when the alloc failed. The mutex is released in the normal exit path - we miss it if we early return here.

---
 drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +4 -2
index b79ef44732d8..a2c199219224 100644
@@ -265,8 +265,10 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
 	phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
 
 	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, mt7915_wtbl_size(dev));
-	if (idx < 0)
-		return -ENOSPC;
+	if (idx < 0) {
+		ret = -ENOSPC;
+		goto out;
+	}
 
 	INIT_LIST_HEAD(&mvif->sta.rc_list);
 	INIT_LIST_HEAD(&mvif->sta.wcid.poll_list);
Signature · 1 line
2.46.0