Skip to content

Commit a597432

Browse files
committed
wifi: mac80211: don't use TPE data from assoc response
Since there's no TPE element in the (re)assoc response, trying to use the data from it just leads to using the defaults, even though the real values had been set during authentication from the discovered BSS information. Fix this by simply not handling the TPE data in assoc response since it's not intended to be present, if it changes later the necessary changes will be made by tracking beacons later. As a side effect, by passing the real frame subtype, now print a correct value for ML reconfiguration responses. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250709233537.caa1ca853f5a.I588271f386731978163aa9d84ae75d6f79633e16@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 93370f2 commit a597432

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

net/mac80211/mlme.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,18 +1214,36 @@ EXPORT_SYMBOL_IF_MAC80211_KUNIT(ieee80211_determine_chan_mode);
12141214

12151215
static int ieee80211_config_bw(struct ieee80211_link_data *link,
12161216
struct ieee802_11_elems *elems,
1217-
bool update, u64 *changed,
1218-
const char *frame)
1217+
bool update, u64 *changed, u16 stype)
12191218
{
12201219
struct ieee80211_channel *channel = link->conf->chanreq.oper.chan;
12211220
struct ieee80211_sub_if_data *sdata = link->sdata;
12221221
struct ieee80211_chan_req chanreq = {};
12231222
struct cfg80211_chan_def ap_chandef;
12241223
enum ieee80211_conn_mode ap_mode;
1224+
const char *frame;
12251225
u32 vht_cap_info = 0;
12261226
u16 ht_opmode;
12271227
int ret;
12281228

1229+
switch (stype) {
1230+
case IEEE80211_STYPE_BEACON:
1231+
frame = "beacon";
1232+
break;
1233+
case IEEE80211_STYPE_ASSOC_RESP:
1234+
frame = "assoc response";
1235+
break;
1236+
case IEEE80211_STYPE_REASSOC_RESP:
1237+
frame = "reassoc response";
1238+
break;
1239+
case IEEE80211_STYPE_ACTION:
1240+
/* the only action frame that gets here */
1241+
frame = "ML reconf response";
1242+
break;
1243+
default:
1244+
return -EINVAL;
1245+
}
1246+
12291247
/* don't track any bandwidth changes in legacy/S1G modes */
12301248
if (link->u.mgd.conn.mode == IEEE80211_CONN_MODE_LEGACY ||
12311249
link->u.mgd.conn.mode == IEEE80211_CONN_MODE_S1G)
@@ -1274,7 +1292,9 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
12741292
ieee80211_min_bw_limit_from_chandef(&chanreq.oper))
12751293
ieee80211_chandef_downgrade(&chanreq.oper, NULL);
12761294

1277-
if (ap_chandef.chan->band == NL80211_BAND_6GHZ &&
1295+
/* TPE element is not present in (re)assoc/ML reconfig response */
1296+
if (stype == IEEE80211_STYPE_BEACON &&
1297+
ap_chandef.chan->band == NL80211_BAND_6GHZ &&
12781298
link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) {
12791299
ieee80211_rearrange_tpe(&elems->tpe, &ap_chandef,
12801300
&chanreq.oper);
@@ -5348,7 +5368,9 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
53485368
/* check/update if AP changed anything in assoc response vs. scan */
53495369
if (ieee80211_config_bw(link, elems,
53505370
link_id == assoc_data->assoc_link_id,
5351-
changed, "assoc response")) {
5371+
changed,
5372+
le16_to_cpu(mgmt->frame_control) &
5373+
IEEE80211_FCTL_STYPE)) {
53525374
ret = false;
53535375
goto out;
53545376
}
@@ -7543,7 +7565,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
75437565

75447566
changed |= ieee80211_recalc_twt_req(sdata, sband, link, link_sta, elems);
75457567

7546-
if (ieee80211_config_bw(link, elems, true, &changed, "beacon")) {
7568+
if (ieee80211_config_bw(link, elems, true, &changed,
7569+
IEEE80211_STYPE_BEACON)) {
75477570
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
75487571
WLAN_REASON_DEAUTH_LEAVING,
75497572
true, deauth_buf);

0 commit comments

Comments
 (0)