]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cfg80211: validate EHT MLE before MLD ID read
authorHaofeng Li <lihaofeng@kylinos.cn>
Wed, 1 Jul 2026 09:33:27 +0000 (17:33 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 6 Jul 2026 12:11:08 +0000 (14:11 +0200)
cfg80211_gen_new_ie() copies ML probe response elements from
the parent frame when the parent EHT multi-link element has an
MLD ID matching the nontransmitted BSSID index.

The code only checked that the extension element had more than
one byte before calling ieee80211_mle_get_mld_id(). That helper
assumes a BASIC MLE with enough common info and documents that
callers must first use ieee80211_mle_type_ok().

Attack chain:
malicious AP sends a short EHT MLE in an MBSSID beacon.
cfg80211_inform_bss_frame_data() stores the copied IE buffer.
cfg80211_parse_mbssid_data() builds the nontransmitted BSS IE.
cfg80211_gen_new_ie() sees the EHT MLE in the parent frame.
ieee80211_mle_get_mld_id() then reads past the IE boundary.

Validate the MLE type and size before reading the MLD ID. This
matches the contract required by the MLE helper and rejects the
short element before any internal MLE fields are accessed.

Cc: stable@vger.kernel.org
Fixes: 61dcfa8c2a8f ("wifi: cfg80211: copy multi-link element from the multi-link probe request's frame body to the generated elements")
Signed-off-by: Haofeng Li <lihaofeng@kylinos.cn>
Link: https://patch.msgid.link/20260701093327.2680709-1-lihaofeng@kylinos.cn
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/scan.c

index 38001684014d9497cf69027f9544102120970033..e1c09040a5c81a5b8a37349e5f7d38d0441c40ca 100644 (file)
@@ -326,8 +326,11 @@ cfg80211_gen_new_ie(const u8 *ie, size_t ielen,
                /* For ML probe response, match the MLE in the frame body with
                 * MLD id being 'bssid_index'
                 */
-               if (parent->id == WLAN_EID_EXTENSION && parent->datalen > 1 &&
+               if (parent->id == WLAN_EID_EXTENSION &&
                    parent->data[0] == WLAN_EID_EXT_EHT_MULTI_LINK &&
+                   ieee80211_mle_type_ok(parent->data + 1,
+                                         IEEE80211_ML_CONTROL_TYPE_BASIC,
+                                         parent->datalen - 1) &&
                    bssid_index == ieee80211_mle_get_mld_id(parent->data + 1)) {
                        if (!cfg80211_copy_elem_with_frags(parent,
                                                           ie, ielen,