Commit 7d288640 authored by Markus Theil's avatar Markus Theil Committed by Felix Fietkau
Browse files

mt76: mt76x02: add check for invalid vif idx



On adding vifs the idx can become 1 + (7 & 7) = 8 for APs.
Check against that, as only AP vif idx 0-7 is possible.

Signed-off-by: default avatarMarkus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent f27469a9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -325,7 +325,9 @@ mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
	if (vif->type == NL80211_IFTYPE_STATION)
		idx += 8;

	if (dev->vif_mask & BIT(idx))
	/* vif is already set or idx is 8 for AP/Mesh/... */
	if (dev->vif_mask & BIT(idx) ||
	    (vif->type != NL80211_IFTYPE_STATION && idx > 7))
		return -EBUSY;

	dev->vif_mask |= BIT(idx);