]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mac80211: don't use TPE data from assoc response
authorJohannes Berg <johannes.berg@intel.com>
Wed, 9 Jul 2025 20:38:03 +0000 (23:38 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 15 Jul 2025 09:00:40 +0000 (11:00 +0200)
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 <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250709233537.caa1ca853f5a.I588271f386731978163aa9d84ae75d6f79633e16@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index 7a8643f0892903db3d37fb09b20b96e187a2be49..5298dbbb5341cd2443e5b6824663e268d3ba6e32 100644 (file)
@@ -1214,18 +1214,36 @@ EXPORT_SYMBOL_IF_MAC80211_KUNIT(ieee80211_determine_chan_mode);
 
 static int ieee80211_config_bw(struct ieee80211_link_data *link,
                               struct ieee802_11_elems *elems,
-                              bool update, u64 *changed,
-                              const char *frame)
+                              bool update, u64 *changed, u16 stype)
 {
        struct ieee80211_channel *channel = link->conf->chanreq.oper.chan;
        struct ieee80211_sub_if_data *sdata = link->sdata;
        struct ieee80211_chan_req chanreq = {};
        struct cfg80211_chan_def ap_chandef;
        enum ieee80211_conn_mode ap_mode;
+       const char *frame;
        u32 vht_cap_info = 0;
        u16 ht_opmode;
        int ret;
 
+       switch (stype) {
+       case IEEE80211_STYPE_BEACON:
+               frame = "beacon";
+               break;
+       case IEEE80211_STYPE_ASSOC_RESP:
+               frame = "assoc response";
+               break;
+       case IEEE80211_STYPE_REASSOC_RESP:
+               frame = "reassoc response";
+               break;
+       case IEEE80211_STYPE_ACTION:
+               /* the only action frame that gets here */
+               frame = "ML reconf response";
+               break;
+       default:
+               return -EINVAL;
+       }
+
        /* don't track any bandwidth changes in legacy/S1G modes */
        if (link->u.mgd.conn.mode == IEEE80211_CONN_MODE_LEGACY ||
            link->u.mgd.conn.mode == IEEE80211_CONN_MODE_S1G)
@@ -1274,7 +1292,9 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
                        ieee80211_min_bw_limit_from_chandef(&chanreq.oper))
                ieee80211_chandef_downgrade(&chanreq.oper, NULL);
 
-       if (ap_chandef.chan->band == NL80211_BAND_6GHZ &&
+       /* TPE element is not present in (re)assoc/ML reconfig response */
+       if (stype == IEEE80211_STYPE_BEACON &&
+           ap_chandef.chan->band == NL80211_BAND_6GHZ &&
            link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) {
                ieee80211_rearrange_tpe(&elems->tpe, &ap_chandef,
                                        &chanreq.oper);
@@ -5348,7 +5368,9 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
        /* check/update if AP changed anything in assoc response vs. scan */
        if (ieee80211_config_bw(link, elems,
                                link_id == assoc_data->assoc_link_id,
-                               changed, "assoc response")) {
+                               changed,
+                               le16_to_cpu(mgmt->frame_control) &
+                                       IEEE80211_FCTL_STYPE)) {
                ret = false;
                goto out;
        }
@@ -7543,7 +7565,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
 
        changed |= ieee80211_recalc_twt_req(sdata, sband, link, link_sta, elems);
 
-       if (ieee80211_config_bw(link, elems, true, &changed, "beacon")) {
+       if (ieee80211_config_bw(link, elems, true, &changed,
+                               IEEE80211_STYPE_BEACON)) {
                ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
                                       WLAN_REASON_DEAUTH_LEAVING,
                                       true, deauth_buf);