Skip to contentSkip to conversation

wifi: mac80211: bounds-check link_id in ieee80211_ml_reconfiguration

PATCH In review cr-ArielSilver 2 participants 2 messages Feb 20 – Feb 23 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/1 wifi: mac80211: bounds-check link_id in ieee80211_ml_reconfiguration

From: Ariel Silver <[email protected]>

link_id is taken from the ML Reconfiguration element (control & 0x000f), so it can be 0..15. link_removal_timeout[] has IEEE80211_MLD_MAX_NUM_LINKS
(15) elements, so index 15 is out-of-bounds. Skip subelements with link_id >= IEEE80211_MLD_MAX_NUM_LINKS to avoid a stack out-of-bounds write.

Fixes 8eb8dd2ffbbb ("wifi: mac80211: Support link removal using Reconfiguration ML element")
---
 net/mac80211/mlme.c | 4 ++++
 1 file changed, 4 insertions(+)
net/mac80211/mlme.c +3 -0
@@ -7073,6 +7073,10 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata,
 		control = le16_to_cpu(prof->control);
 		link_id = control & IEEE80211_MLE_STA_RECONF_CONTROL_LINK_ID;
 
+		if (link_id >= IEEE80211_MLD_MAX_NUM_LINKS)
+			continue;
+
 		removed_links |= BIT(link_id);
 
 		/* the MAC address should not be included, but handle it */
maintainer
#2 lore raw
Quoted 11 lines · cr-ArielSilver

From: Ariel Silver <[email protected]>

link_id is taken from the ML Reconfiguration element (control & 0x000f), so it can be 0..15. link_removal_timeout[] has IEEE80211_MLD_MAX_NUM_LINKS
(15) elements, so index 15 is out-of-bounds. Skip subelements with link_id >= IEEE80211_MLD_MAX_NUM_LINKS to avoid a stack out-of-bounds write.

Fixes 8eb8dd2ffbbb ("wifi: mac80211: Support link removal using Reconfiguration ML element")

I'll apply this anyway, but ...

net/mac80211/mlme.c static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata,

Quoted 3 lines
net/mac80211/mlme.c +0 -0
@@ -7073,6 +7073,10 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata,

How did this line happen? You're only adding 3 new lines. How is it even _possible_ to get this wrong?!

johannes