Commit 0c2fd18f authored by Lingbo Kong's avatar Lingbo Kong Committed by Johannes Berg

wifi: mac80211: fix Spatial Reuse element size check

Currently, the way to check the size of Spatial Reuse IE data in the
ieee80211_parse_extension_element() is incorrect.

This is because the len variable in the ieee80211_parse_extension_element()
function is equal to the size of Spatial Reuse IE data minus one and the
value of returned by the ieee80211_he_spr_size() function is equal to
the length of Spatial Reuse IE data. So the result of the
len >= ieee80211_he_spr_size(data) statement always false.

To address this issue and make it consistent with the logic used elsewhere
with ieee80211_he_oper_size(), change the
"len >= ieee80211_he_spr_size(data)" to
“len >= ieee80211_he_spr_size(data) - 1”.

Fixes: 9d0480a7 ("wifi: mac80211: move element parsing to a new file")
Signed-off-by: default avatarLingbo Kong <quic_lingbok@quicinc.com>
Link: https://msgid.link/20240516021854.5682-2-quic_lingbok@quicinc.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 4bb95f45
...@@ -111,7 +111,7 @@ ieee80211_parse_extension_element(u32 *crc, ...@@ -111,7 +111,7 @@ ieee80211_parse_extension_element(u32 *crc,
if (params->mode < IEEE80211_CONN_MODE_HE) if (params->mode < IEEE80211_CONN_MODE_HE)
break; break;
if (len >= sizeof(*elems->he_spr) && if (len >= sizeof(*elems->he_spr) &&
len >= ieee80211_he_spr_size(data)) len >= ieee80211_he_spr_size(data) - 1)
elems->he_spr = data; elems->he_spr = data;
break; break;
case WLAN_EID_EXT_HE_6GHZ_CAPA: case WLAN_EID_EXT_HE_6GHZ_CAPA:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment