Commit b84882c2 authored by Johannes Berg's avatar Johannes Berg Committed by Wen Zhiwei
Browse files

wifi: iwlwifi: mvm: fix 6 GHz scan construction

stable inclusion
from stable-v6.6.60
commit fc621e7a043de346c33bd7ae7e2e0c651d6152ef
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB44K1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fc621e7a043de346c33bd7ae7e2e0c651d6152ef

--------------------------------

commit 7245012f0f496162dd95d888ed2ceb5a35170f1a upstream.

If more than 255 colocated APs exist for the set of all
APs found during 2.4/5 GHz scanning, then the 6 GHz scan
construction will loop forever since the loop variable
has type u8, which can never reach the number found when
that's bigger than 255, and is stored in a u32 variable.
Also move it into the loops to have a smaller scope.

Using a u32 there is fine, we limit the number of APs in
the scan list and each has a limit on the number of RNR
entries due to the frame size. With a limit of 1000 scan
results, a frame size upper bound of 4096 (really it's
more like ~2300) and a TBTT entry size of at least 11,
we get an upper bound for the number of ~372k, well in
the bounds of a u32.

Cc: stable@vger.kernel.org
Fixes: eae94cf8 ("iwlwifi: mvm: add support for 6GHz")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219375
Link: https://patch.msgid.link/20241023091744.f4baed5c08a1.I8b417148bbc8c5d11c101e1b8f5bf372e17bf2a7@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 92bc25fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1751,7 +1751,8 @@ iwl_mvm_umac_scan_cfg_channels_v7_6g(struct iwl_mvm *mvm,
			&cp->channel_config[ch_cnt];

		u32 s_ssid_bitmap = 0, bssid_bitmap = 0, flags = 0;
		u8 j, k, s_max = 0, b_max = 0, n_used_bssid_entries;
		u8 k, s_max = 0, b_max = 0, n_used_bssid_entries;
		u32 j;
		bool force_passive, found = false, allow_passive = true,
		     unsolicited_probe_on_chan = false, psc_no_listen = false;
		s8 psd_20 = IEEE80211_RNR_TBTT_PARAMS_PSD_RESERVED;