wifi: mac80211: bounds-check link_id in ieee80211_ml_reconfiguration
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
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.
--- 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 */
Johannes Berg
maintainerQuoted 11 lines · cr-ArielSilver
From: Ariel Silver <[email protected]>
link_idis taken from the ML Reconfiguration element (control &0x000f), so it can be 0..15. link_removal_timeout[] hasIEEE80211_MLD_MAX_NUM_LINKS
(15) elements, so index 15 is out-of-bounds. Skip subelements withlink_id>=IEEE80211_MLD_MAX_NUM_LINKSto avoid a stack out-of-bounds write.Fixes 8eb8dd2ffbbb ("wifi: mac80211: Support link removal using Reconfiguration ML element")Reported-by Ariel Silver <[email protected]>Signed-off-by Ariel Silver <[email protected]>
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