From: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com
commit efbe8f81952fe469d38655744627d860879dcde8 upstream.
Validate index before access iwl_rate_mcs to keep rate->index inside the valid boundaries. Use MCS_0_INDEX if index is less than MCS_0_INDEX and MCS_9_INDEX if index is greater than MCS_9_INDEX.
Signed-off-by: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com Signed-off-by: Gregory Greenman gregory.greenman@intel.com Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78c... Signed-off-by: Johannes Berg johannes.berg@intel.com Signed-off-by: Dmitry Antipov dmantipov@yandex.ru --- drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 9 ++++++--- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c index 687c906a9d72..4b1f006c105b 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. - * Copyright (C) 2019 - 2020, 2022 Intel Corporation + * Copyright (C) 2019 - 2020, 2022 - 2023 Intel Corporation *****************************************************************************/ #include <linux/kernel.h> #include <linux/skbuff.h> @@ -125,7 +125,7 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) return idx; }
- return -1; + return IWL_RATE_INVALID; }
static void rs_rate_scale_perform(struct iwl_priv *priv, @@ -3146,7 +3146,10 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { index = iwl_hwrate_to_plcp_idx( le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); - if (is_legacy(tbl->lq_type)) { + if (index == IWL_RATE_INVALID) { + desc += sprintf(buff + desc, " rate[%d] 0x%X invalid rate\n", + i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); + } else if (is_legacy(tbl->lq_type)) { desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), iwl_rate_mcs[index].mbps); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c index 2be6801d48ac..e42387a4663a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c @@ -1,7 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /****************************************************************************** * - * Copyright(c) 2005 - 2014, 2018 - 2021 Intel Corporation. All rights reserved. + * Copyright(c) 2005 - 2014, 2018 - 2021, 2023 Intel Corporation. + * All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH *****************************************************************************/ @@ -1072,10 +1073,13 @@ static void rs_get_lower_rate_down_column(struct iwl_lq_sta *lq_sta,
rate->bw = RATE_MCS_CHAN_WIDTH_20;
- WARN_ON_ONCE(rate->index < IWL_RATE_MCS_0_INDEX || - rate->index > IWL_RATE_MCS_9_INDEX); + if (WARN_ON_ONCE(rate->index < IWL_RATE_MCS_0_INDEX)) + rate->index = rs_ht_to_legacy[IWL_RATE_MCS_0_INDEX]; + else if (WARN_ON_ONCE(rate->index > IWL_RATE_MCS_9_INDEX)) + rate->index = rs_ht_to_legacy[IWL_RATE_MCS_9_INDEX]; + else + rate->index = rs_ht_to_legacy[rate->index];
- rate->index = rs_ht_to_legacy[rate->index]; rate->ldpc = false; } else { /* Downgrade to SISO with same MCS if in MIMO */
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: efbe8f81952fe469d38655744627d860879dcde8
WARNING: Author mismatch between patch and upstream commit: Backport author: Dmitry Antipovdmantipov@yandex.ru Commit author: Anjaneyulupagadala.yesu.anjaneyulu@intel.com
Status in newer kernel trees: 6.13.y | Branch not found 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Not found
Note: The patch differs from the upstream commit: --- 1: efbe8f81952fe ! 1: 434d51c97c555 wifi: iwlwifi: add a few rate index validity checks @@ Metadata ## Commit message ## wifi: iwlwifi: add a few rate index validity checks
+ commit efbe8f81952fe469d38655744627d860879dcde8 upstream. + Validate index before access iwl_rate_mcs to keep rate->index inside the valid boundaries. Use MCS_0_INDEX if index is less - than MCS_0_INDEX and MCS_9_INDEX if index is greater then + than MCS_0_INDEX and MCS_9_INDEX if index is greater than MCS_9_INDEX.
Signed-off-by: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com Signed-off-by: Gregory Greenman gregory.greenman@intel.com Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78c... Signed-off-by: Johannes Berg johannes.berg@intel.com + Signed-off-by: Dmitry Antipov dmantipov@yandex.ru
## drivers/net/wireless/intel/iwlwifi/dvm/rs.c ## @@ @@ drivers/net/wireless/intel/iwlwifi/mvm/rs.c // SPDX-License-Identifier: GPL-2.0-only /****************************************************************************** * -- * Copyright(c) 2005 - 2014, 2018 - 2022 Intel Corporation. All rights reserved. -+ * Copyright(c) 2005 - 2014, 2018 - 2023 Intel Corporation. All rights reserved. +- * Copyright(c) 2005 - 2014, 2018 - 2021 Intel Corporation. All rights reserved. ++ * Copyright(c) 2005 - 2014, 2018 - 2021, 2023 Intel Corporation. ++ * All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH *****************************************************************************/ ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |
On Tue, Jan 28, 2025 at 12:59:35PM +0300, Dmitry Antipov wrote:
From: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com
commit efbe8f81952fe469d38655744627d860879dcde8 upstream.
Validate index before access iwl_rate_mcs to keep rate->index inside the valid boundaries. Use MCS_0_INDEX if index is less than MCS_0_INDEX and MCS_9_INDEX if index is greater than MCS_9_INDEX.
Signed-off-by: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com Signed-off-by: Gregory Greenman gregory.greenman@intel.com Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78c... Signed-off-by: Johannes Berg johannes.berg@intel.com Signed-off-by: Dmitry Antipov dmantipov@yandex.ru
drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 9 ++++++--- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c index 687c906a9d72..4b1f006c105b 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c @@ -2,7 +2,7 @@ /******************************************************************************
- Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
- Copyright (C) 2019 - 2020, 2022 Intel Corporation
*****************************************************************************/
- Copyright (C) 2019 - 2020, 2022 - 2023 Intel Corporation
#include <linux/kernel.h> #include <linux/skbuff.h> @@ -125,7 +125,7 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) return idx; }
- return -1;
- return IWL_RATE_INVALID;
} static void rs_rate_scale_perform(struct iwl_priv *priv, @@ -3146,7 +3146,10 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { index = iwl_hwrate_to_plcp_idx( le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags));
if (is_legacy(tbl->lq_type)) {
if (index == IWL_RATE_INVALID) {
desc += sprintf(buff + desc, " rate[%d] 0x%X invalid rate\n",
i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags));
} else if (is_legacy(tbl->lq_type)) { desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), iwl_rate_mcs[index].mbps);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c index 2be6801d48ac..e42387a4663a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c @@ -1,7 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /******************************************************************************
- Copyright(c) 2005 - 2014, 2018 - 2021 Intel Corporation. All rights reserved.
- Copyright(c) 2005 - 2014, 2018 - 2021, 2023 Intel Corporation.
- All rights reserved.
Why did you wrap the copyright line like this? Please just leave it alone for backports, or better yet, follow what was done upstream in the original patch.
thanks,
greg k-h
From: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com
commit efbe8f81952fe469d38655744627d860879dcde8 upstream.
Validate index before access iwl_rate_mcs to keep rate->index inside the valid boundaries. Use MCS_0_INDEX if index is less than MCS_0_INDEX and MCS_9_INDEX if index is greater than MCS_9_INDEX.
Signed-off-by: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com Signed-off-by: Gregory Greenman gregory.greenman@intel.com Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78c... Signed-off-by: Johannes Berg johannes.berg@intel.com Signed-off-by: Dmitry Antipov dmantipov@yandex.ru --- v2: (re)adjust copyright notice --- drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 9 ++++++--- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c index 687c906a9d72..4b1f006c105b 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. - * Copyright (C) 2019 - 2020, 2022 Intel Corporation + * Copyright (C) 2019 - 2020, 2022 - 2023 Intel Corporation *****************************************************************************/ #include <linux/kernel.h> #include <linux/skbuff.h> @@ -125,7 +125,7 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) return idx; }
- return -1; + return IWL_RATE_INVALID; }
static void rs_rate_scale_perform(struct iwl_priv *priv, @@ -3146,7 +3146,10 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { index = iwl_hwrate_to_plcp_idx( le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); - if (is_legacy(tbl->lq_type)) { + if (index == IWL_RATE_INVALID) { + desc += sprintf(buff + desc, " rate[%d] 0x%X invalid rate\n", + i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); + } else if (is_legacy(tbl->lq_type)) { desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), iwl_rate_mcs[index].mbps); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c index 2be6801d48ac..ef9ecc4650d1 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /****************************************************************************** * - * Copyright(c) 2005 - 2014, 2018 - 2021 Intel Corporation. All rights reserved. + * Copyright(c) 2005 - 2014, 2018 - 2023 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH *****************************************************************************/ @@ -1072,10 +1072,13 @@ static void rs_get_lower_rate_down_column(struct iwl_lq_sta *lq_sta,
rate->bw = RATE_MCS_CHAN_WIDTH_20;
- WARN_ON_ONCE(rate->index < IWL_RATE_MCS_0_INDEX || - rate->index > IWL_RATE_MCS_9_INDEX); + if (WARN_ON_ONCE(rate->index < IWL_RATE_MCS_0_INDEX)) + rate->index = rs_ht_to_legacy[IWL_RATE_MCS_0_INDEX]; + else if (WARN_ON_ONCE(rate->index > IWL_RATE_MCS_9_INDEX)) + rate->index = rs_ht_to_legacy[IWL_RATE_MCS_9_INDEX]; + else + rate->index = rs_ht_to_legacy[rate->index];
- rate->index = rs_ht_to_legacy[rate->index]; rate->ldpc = false; } else { /* Downgrade to SISO with same MCS if in MIMO */
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: efbe8f81952fe469d38655744627d860879dcde8
WARNING: Author mismatch between patch and upstream commit: Backport author: Dmitry Antipovdmantipov@yandex.ru Commit author: Anjaneyulupagadala.yesu.anjaneyulu@intel.com
Status in newer kernel trees: 6.13.y | Branch not found 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Not found
Note: The patch differs from the upstream commit: --- 1: efbe8f81952fe ! 1: bd8976ccdf328 wifi: iwlwifi: add a few rate index validity checks @@ Metadata ## Commit message ## wifi: iwlwifi: add a few rate index validity checks
+ commit efbe8f81952fe469d38655744627d860879dcde8 upstream. + Validate index before access iwl_rate_mcs to keep rate->index inside the valid boundaries. Use MCS_0_INDEX if index is less - than MCS_0_INDEX and MCS_9_INDEX if index is greater then + than MCS_0_INDEX and MCS_9_INDEX if index is greater than MCS_9_INDEX.
Signed-off-by: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com Signed-off-by: Gregory Greenman gregory.greenman@intel.com Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78c... Signed-off-by: Johannes Berg johannes.berg@intel.com + Signed-off-by: Dmitry Antipov dmantipov@yandex.ru
## drivers/net/wireless/intel/iwlwifi/dvm/rs.c ## @@ @@ drivers/net/wireless/intel/iwlwifi/mvm/rs.c // SPDX-License-Identifier: GPL-2.0-only /****************************************************************************** * -- * Copyright(c) 2005 - 2014, 2018 - 2022 Intel Corporation. All rights reserved. +- * Copyright(c) 2005 - 2014, 2018 - 2021 Intel Corporation. All rights reserved. + * Copyright(c) 2005 - 2014, 2018 - 2023 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |
On Wed, Jan 29, 2025 at 05:32:30PM +0300, Dmitry Antipov wrote:
From: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com
commit efbe8f81952fe469d38655744627d860879dcde8 upstream.
Validate index before access iwl_rate_mcs to keep rate->index inside the valid boundaries. Use MCS_0_INDEX if index is less than MCS_0_INDEX and MCS_9_INDEX if index is greater than MCS_9_INDEX.
Signed-off-by: Anjaneyulu pagadala.yesu.anjaneyulu@intel.com Signed-off-by: Gregory Greenman gregory.greenman@intel.com Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78c... Signed-off-by: Johannes Berg johannes.berg@intel.com Signed-off-by: Dmitry Antipov dmantipov@yandex.ru
v2: (re)adjust copyright notice
You also fixed the grammer in the changelog! Ugh, let me just go backport these myself, please don't change things that you shouldn't need to change...
greg k-h
linux-stable-mirror@lists.linaro.org