Skip to content

Commit 3fa2886

Browse files
benzeajmberg-intel
authored andcommitted
wifi: mac80211: parse all TTLM entries
For the follow up patch, we need to properly parse TTLM entries that do not have a switch time. Change the logic so that ieee80211_parse_adv_t2l returns usable values in all non-error cases. Before the values filled in were technically incorrect but enough for ieee80211_process_adv_ttlm. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20260118093904.ccd324e2dd59.I69f0bee0a22e9b11bb95beef313e305dab17c051@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 3f3d8ff commit 3fa2886

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

net/mac80211/mlme.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7015,10 +7015,6 @@ ieee80211_parse_adv_t2l(struct ieee80211_sub_if_data *sdata,
70157015
pos = (void *)ttlm->optional;
70167016
control = ttlm->control;
70177017

7018-
if ((control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP) ||
7019-
!(control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT))
7020-
return 0;
7021-
70227018
if ((control & IEEE80211_TTLM_CONTROL_DIRECTION) !=
70237019
IEEE80211_TTLM_DIRECTION_BOTH) {
70247020
sdata_info(sdata, "Invalid advertised T2L map direction\n");
@@ -7028,21 +7024,28 @@ ieee80211_parse_adv_t2l(struct ieee80211_sub_if_data *sdata,
70287024
link_map_presence = *pos;
70297025
pos++;
70307026

7031-
ttlm_info->switch_time = get_unaligned_le16(pos);
7027+
if (control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT) {
7028+
ttlm_info->switch_time = get_unaligned_le16(pos);
70327029

7033-
/* Since ttlm_info->switch_time == 0 means no switch time, bump it
7034-
* by 1.
7035-
*/
7036-
if (!ttlm_info->switch_time)
7037-
ttlm_info->switch_time = 1;
7030+
/* Since ttlm_info->switch_time == 0 means no switch time, bump
7031+
* it by 1.
7032+
*/
7033+
if (!ttlm_info->switch_time)
7034+
ttlm_info->switch_time = 1;
70387035

7039-
pos += 2;
7036+
pos += 2;
7037+
}
70407038

70417039
if (control & IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT) {
70427040
ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16;
70437041
pos += 3;
70447042
}
70457043

7044+
if (control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP) {
7045+
ttlm_info->map = 0xffff;
7046+
return 0;
7047+
}
7048+
70467049
if (control & IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE)
70477050
map_size = 1;
70487051
else

0 commit comments

Comments
 (0)