From c845c940546bc8b7f04adff02e4756f4be4cfe3c Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Apr 17 2023 12:19:06 +0000 Subject: iwlwifi: fw: make pos static in iwl_sar_get_ewrd_table() loop (git-fixes). --- diff --git a/patches.suse/iwlwifi-fw-make-pos-static-in-iwl_sar_get_ewrd_table.patch b/patches.suse/iwlwifi-fw-make-pos-static-in-iwl_sar_get_ewrd_table.patch new file mode 100644 index 0000000..4ff0e5a --- /dev/null +++ b/patches.suse/iwlwifi-fw-make-pos-static-in-iwl_sar_get_ewrd_table.patch @@ -0,0 +1,47 @@ +From fb3c06cfda0db68f6082f05c43d63c1fb1761af0 Mon Sep 17 00:00:00 2001 +From: Luca Coelho +Date: Mon, 23 Dec 2019 13:00:59 +0200 +Subject: [PATCH] iwlwifi: fw: make pos static in iwl_sar_get_ewrd_table() loop +Git-commit: fb3c06cfda0db68f6082f05c43d63c1fb1761af0 +References: git-fixes +Patch-mainline: v5.5 + +In the for loop where we are supposed to go through the entire table, +we are using a non-static local to keep the pos index. This makes +each iteration start with 3, so we always access the first item on the +table. Fix this by moving the variable outside of the loo so it +doesn't lose its value at every iteration. + +Reported-by: Colin Ian King +Signed-off-by: Luca Coelho +Fixes: ba3224db7803 ("iwlwifi: mvm: fix an out-of-bound access") +Signed-off-by: Luca Coelho +Signed-off-by: Oliver Neukum +--- + drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +@@ -690,7 +690,7 @@ static int iwl_mvm_sar_get_ewrd_table(st + { + union acpi_object *wifi_pkg, *data; + bool enabled; +- int i, n_profiles, ret; ++ int i, n_profiles, ret, pos; + + data = iwl_acpi_get_object(mvm->dev, ACPI_EWRD_METHOD); + if (IS_ERR(data)) +@@ -722,10 +722,9 @@ static int iwl_mvm_sar_get_ewrd_table(st + goto out_free; + } + ++ /* the tables start at element 3 */ ++ pos = 3; + for (i = 0; i < n_profiles; i++) { +- /* the tables start at element 3 */ +- int pos = 3; +- + /* The EWRD profiles officially go from 2 to 4, but we + * save them in sar_profiles[1-3] (because we don't + * have profile 0). So in the array we start from 1. diff --git a/series.conf b/series.conf index 5f383aa..ab100f1 100644 --- a/series.conf +++ b/series.conf @@ -54746,6 +54746,7 @@ patches.suse/tun-add-mutex_unlock-call-and-napi.skb-clearing-in-t.patch patches.suse/libertas-Fix-two-buffer-overflows-at-parsing-bss-des.patch patches.suse/iwlwifi-mvm-fix-NVM-check-for-3168-devices.patch + patches.suse/iwlwifi-fw-make-pos-static-in-iwl_sar_get_ewrd_table.patch patches.suse/0004-net-sonic-Add-mutual-exclusion-for-accessing-shared-.patch patches.suse/net_sched-fix-datalen-for-ematch.patch patches.suse/net-cxgb3_main-Add-CAP_NET_ADMIN-check-to-CHELSIO_GE.patch