Skip to content

Commit e3ad987

Browse files
RandDeebMiriam-Rachel
authored andcommitted
wifi: iwlwifi: dvm: fix potential overflow in rs_fill_link_cmd()
The 'index' variable in the rs_fill_link_cmd() function can reach LINK_QUAL_MAX_RETRY_NUM during the execution of the inner loop. This variable is used as an index for the lq_cmd->rs_table array, which has a size of LINK_QUAL_MAX_RETRY_NUM, without proper validation. Modify the condition of the inner loop to ensure that the 'index' variable does not exceed LINK_QUAL_MAX_RETRY_NUM - 1, thereby preventing any potential overflow issues. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rand Deeb <rand.sec96@gmail.com> Link: https://patch.msgid.link/20240313101755.269209-1-rand.sec96@gmail.com Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
1 parent 90a0d9f commit e3ad987

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/wireless/intel/iwlwifi/dvm

1 file changed

+1
-1
lines changed

drivers/net/wireless/intel/iwlwifi/dvm/rs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2899,7 +2899,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
28992899
/* Repeat initial/next rate.
29002900
* For legacy IWL_NUMBER_TRY == 1, this loop will not execute.
29012901
* For HT IWL_HT_NUMBER_TRY == 3, this executes twice. */
2902-
while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) {
2902+
while (repeat_rate > 0 && index < (LINK_QUAL_MAX_RETRY_NUM - 1)) {
29032903
if (is_legacy(tbl_type.lq_type)) {
29042904
if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
29052905
ant_toggle_cnt++;

0 commit comments

Comments
 (0)