Skip to content

Commit 2fb5dfe

Browse files
committed
wifi: mac80211: mlme: re-parse if AP mode is less than client
If the AP mode ends up being determined less than the client mode, there may be different reasons for this, e.g. AP misconfiguration. If this happens in a way that causes e.g. EHT to be rejected, the elements need to be re-parsed since we'll connect as HE, but not reparsing means that we'll still think it's OK to use multi-link, so we can connect in a non-sensical configuration of advertising only HE on a secondary link. This normally won't happen for the assoc link because that reuses the mode from authentication, and if that's not EHT, multi-link association is rejected. Fix this inconsistency by parsing the elements again if the mode was different from the first parsing attempt. Print the message a bit later to avoid printing "determined AP ... to be HE" twice in cases where ieee80211_determine_ap_chan() returned a lesser mode, rather than the regulatory downgrades below changing it. Fixes: 310c838 ("wifi: mac80211: clean up connection process") Reviewed-by: Miriam Rachel Korenblit <[email protected]> Link: https://msgid.link/20240418105220.d1f25d92cfe7.Ia21eff6cdcae2f5aca13cf8e742a986af5e70f89@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 1ac6f60 commit 2fb5dfe

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

net/mac80211/mlme.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,15 +632,21 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
632632
ap_mode = ieee80211_determine_ap_chan(sdata, channel, bss->vht_cap_info,
633633
elems, false, conn, &ap_chandef);
634634

635-
mlme_link_id_dbg(sdata, link_id, "determined AP %pM to be %s\n",
636-
cbss->bssid, ieee80211_conn_mode_str(ap_mode));
637-
638635
/* this should be impossible since parsing depends on our mode */
639636
if (WARN_ON(ap_mode > conn->mode)) {
640637
ret = -EINVAL;
641638
goto free;
642639
}
643640

641+
if (conn->mode != ap_mode) {
642+
conn->mode = ap_mode;
643+
kfree(elems);
644+
goto again;
645+
}
646+
647+
mlme_link_id_dbg(sdata, link_id, "determined AP %pM to be %s\n",
648+
cbss->bssid, ieee80211_conn_mode_str(ap_mode));
649+
644650
sband = sdata->local->hw.wiphy->bands[channel->band];
645651

646652
switch (channel->band) {
@@ -691,7 +697,6 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
691697
break;
692698
}
693699

694-
conn->mode = ap_mode;
695700
chanreq->oper = ap_chandef;
696701

697702
/* wider-bandwidth OFDMA is only done in EHT */

0 commit comments

Comments
 (0)