Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Benjamin Berg and committed by
Johannes Berg
3fa2886d 3f3d8ff3

+14 -11
+14 -11
net/mac80211/mlme.c
··· 7015 7015 pos = (void *)ttlm->optional; 7016 7016 control = ttlm->control; 7017 7017 7018 - if ((control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP) || 7019 - !(control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT)) 7020 - return 0; 7021 - 7022 7018 if ((control & IEEE80211_TTLM_CONTROL_DIRECTION) != 7023 7019 IEEE80211_TTLM_DIRECTION_BOTH) { 7024 7020 sdata_info(sdata, "Invalid advertised T2L map direction\n"); ··· 7024 7028 link_map_presence = *pos; 7025 7029 pos++; 7026 7030 7027 - ttlm_info->switch_time = get_unaligned_le16(pos); 7031 + if (control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT) { 7032 + ttlm_info->switch_time = get_unaligned_le16(pos); 7028 7033 7029 - /* Since ttlm_info->switch_time == 0 means no switch time, bump it 7030 - * by 1. 7031 - */ 7032 - if (!ttlm_info->switch_time) 7033 - ttlm_info->switch_time = 1; 7034 + /* Since ttlm_info->switch_time == 0 means no switch time, bump 7035 + * it by 1. 7036 + */ 7037 + if (!ttlm_info->switch_time) 7038 + ttlm_info->switch_time = 1; 7034 7039 7035 - pos += 2; 7040 + pos += 2; 7041 + } 7036 7042 7037 7043 if (control & IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT) { 7038 7044 ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16; 7039 7045 pos += 3; 7046 + } 7047 + 7048 + if (control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP) { 7049 + ttlm_info->map = 0xffff; 7050 + return 0; 7040 7051 } 7041 7052 7042 7053 if (control & IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE)