From e7e4a015649a7cb570eabd790130a1f3065f2f25 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: May 03 2023 08:08:30 +0000 Subject: wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list() (git-fixes). --- diff --git a/patches.suse/wifi-ath5k-fix-an-off-by-one-check-in-ath5k_eeprom_r.patch b/patches.suse/wifi-ath5k-fix-an-off-by-one-check-in-ath5k_eeprom_r.patch new file mode 100644 index 0000000..003f84a --- /dev/null +++ b/patches.suse/wifi-ath5k-fix-an-off-by-one-check-in-ath5k_eeprom_r.patch @@ -0,0 +1,32 @@ +From: Dan Carpenter +Date: Mon, 6 Feb 2023 16:15:48 +0300 +Subject: wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list() +Git-commit: 4c856ee12df85aabd437c3836ed9f68d94268358 +Patch-mainline: v6.4-rc1 +References: git-fixes + +This loop checks that i < max at the start of loop but then it does +i++ which could put it past the end of the array. It's harmless to +check again and prevent a potential out of bounds. + +Fixes: 1048643ea94d ("ath5k: Clean up eeprom parsing and add missing calibration data") +Signed-off-by: Dan Carpenter +Reviewed-by: Luis Chamberlain +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/Y+D9hPQrHfWBJhXz@kili +Signed-off-by: Jiri Slaby +--- + drivers/net/wireless/ath/ath5k/eeprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath5k/eeprom.c ++++ b/drivers/net/wireless/ath/ath5k/eeprom.c +@@ -529,7 +529,7 @@ ath5k_eeprom_read_freq_list(struct ath5k + ee->ee_n_piers[mode]++; + + freq2 = (val >> 8) & 0xff; +- if (!freq2) ++ if (!freq2 || i >= max) + break; + + pc[i++].freq = ath5k_eeprom_bin2freq(ee, diff --git a/series.conf b/series.conf index 682b5a8..e728725 100644 --- a/series.conf +++ b/series.conf @@ -63259,6 +63259,7 @@ patches.suse/cgroup-cpuset-Wake-up-cpuset_attach_wq-tasks-in-cpuset_cancel_attach.patch patches.suse/cifs-fix-negotiate-context-parsing.patch patches.suse/powerpc-papr_scm-Update-the-NUMA-distance-table-for-.patch + patches.suse/wifi-ath5k-fix-an-off-by-one-check-in-ath5k_eeprom_r.patch # dhowells/linux-fs keys-uefi patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch