Skip to content

Commit

Permalink
mac80211: mesh: fix HE operation element length check
Browse files Browse the repository at this point in the history
The length check here was bad, if the length doesn't at
least include the length of the fixed part, we cannot
call ieee80211_he_oper_size() to determine the total.
Fix this, and convert to cfg80211_find_ext_elem() while
at it.

Cc: [email protected]
Fixes: 70debba ("mac80211: save HE oper info in BSS config for mesh")
Link: https://lore.kernel.org/r/20210930131120.b0f940976c56.I954e1be55e9f87cc303165bff5c906afe1e54648@changeid
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmberg-intel committed Oct 1, 2021
1 parent ca6e11c commit 636707e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/mac80211/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ ieee80211_mesh_update_bss_params(struct ieee80211_sub_if_data *sdata,
u8 *ie, u8 ie_len)
{
struct ieee80211_supported_band *sband;
const u8 *cap;
const struct element *cap;
const struct ieee80211_he_operation *he_oper = NULL;

sband = ieee80211_get_sband(sdata);
Expand All @@ -687,9 +687,10 @@ ieee80211_mesh_update_bss_params(struct ieee80211_sub_if_data *sdata,

sdata->vif.bss_conf.he_support = true;

cap = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_OPERATION, ie, ie_len);
if (cap && cap[1] >= ieee80211_he_oper_size(&cap[3]))
he_oper = (void *)(cap + 3);
cap = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, ie, ie_len);
if (cap && cap->datalen >= 1 + sizeof(*he_oper) &&
cap->datalen >= 1 + ieee80211_he_oper_size(cap->data + 1))
he_oper = (void *)(cap->data + 1);

if (he_oper)
sdata->vif.bss_conf.he_oper.params =
Expand Down

0 comments on commit 636707e

Please sign in to comment.