Skip to content

Commit 64cbf0d

Browse files
LorenzoBianconinbd168
authored andcommitted
wifi: mt76: mt7996: Fix possible OOB access in mt7996_tx()
Fis possible Out-Of-Boundary access in mt7996_tx routine if link_id is set to IEEE80211_LINK_UNSPECIFIED Fixes: 3ce8acb ("wifi: mt76: mt7996: Update mt7996_tx to MLO support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250704-mt7996-mlo-fixes-v1-6-356456c73f43@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent 59ea7af commit 64cbf0d

File tree

1 file changed

+12
-5
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7996

1 file changed

+12
-5
lines changed

drivers/net/wireless/mediatek/mt76/mt7996/main.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,10 +1216,17 @@ static void mt7996_tx(struct ieee80211_hw *hw,
12161216

12171217
if (vif) {
12181218
struct mt7996_vif *mvif = (void *)vif->drv_priv;
1219-
struct mt76_vif_link *mlink;
1219+
struct mt76_vif_link *mlink = &mvif->deflink.mt76;
12201220

1221-
mlink = rcu_dereference(mvif->mt76.link[link_id]);
1222-
if (mlink && mlink->wcid)
1221+
if (link_id < IEEE80211_LINK_UNSPECIFIED)
1222+
mlink = rcu_dereference(mvif->mt76.link[link_id]);
1223+
1224+
if (!mlink) {
1225+
ieee80211_free_txskb(hw, skb);
1226+
goto unlock;
1227+
}
1228+
1229+
if (mlink->wcid)
12231230
wcid = mlink->wcid;
12241231

12251232
if (mvif->mt76.roc_phy &&
@@ -1228,7 +1235,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,
12281235
if (mphy->roc_link)
12291236
wcid = mphy->roc_link->wcid;
12301237
} else {
1231-
mphy = mt76_vif_link_phy(&mvif->deflink.mt76);
1238+
mphy = mt76_vif_link_phy(mlink);
12321239
}
12331240
}
12341241

@@ -1237,7 +1244,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,
12371244
goto unlock;
12381245
}
12391246

1240-
if (control->sta) {
1247+
if (control->sta && link_id < IEEE80211_LINK_UNSPECIFIED) {
12411248
struct mt7996_sta *msta = (void *)control->sta->drv_priv;
12421249
struct mt7996_sta_link *msta_link;
12431250

0 commit comments

Comments
 (0)