Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2221664rwb; Mon, 15 Aug 2022 00:51:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR49LyMEGSdQ829cbTw0d/RTdirokBkePEukkm9Y0qlU/cpK+J7p8+D7O/vGAwscJZlwIap4 X-Received: by 2002:a17:902:9f87:b0:170:c7fc:388c with SMTP id g7-20020a1709029f8700b00170c7fc388cmr15978501plq.168.1660549882790; Mon, 15 Aug 2022 00:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660549882; cv=none; d=google.com; s=arc-20160816; b=pV2VKMC5ROvobwnWu6fq0GLgyiUa1JAc2Rexd4NaLZf6+I88EI7TSYjg8qr8V3es2b AZ0vdGkWaT6YiaFqhzID4xmz3PjRywBQjD7tYdA/oQsUUACBJ7W10E8cir1jxIZlK0fb naw1zOe1vgo5k7ZkpEpEg1bUNm/nMjhbLSEXKvDu08oH8FSNGh99BR9qDxzpsiJ+sOiX azzVAOnPq0xNU/UnNTEHk/KPqhva7LMVkb1+V2PpqTEmFGz6StBlZiUvyAHdvM04vMls njyLZyp3BAKHtQIhXz4sShaaNiQDY6qN+rdYw4rLb4xXP5qsOPrdQ8W9aAZ44TJMolMu TA2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jhDqEhiGM+n8Cdl5DAdtoFPYD0xgBQR3XpaUP79LM9o=; b=eINKj9q/+YOJl1qS+/4WFKO0y7zHOzhhWVkywoknMneV3CojbQrH3oAJmyD7hl5pi/ c3wbQp03rXlBDS49VCQwnsE3ZfZcV/lfhW7My0lSettuud5U0mOJMlXfrsNgf7OiL0I8 VXKFWn94OJ2l2ybt+/rcLRqFCjLJmJHkkC3c7LFlvVLcN84dHtLR/K/FgKoS6mMmQ5av X4W2DWXJVTXhVZVL7VoE3hNvOmCosnsi/1ahVB62qJ6TONSqgInzpk9WJhaqjy33xd37 QGjO4cAAF797NCJr6Q6+HRv8rz1G877SWp+QIhKAkAEUGLoEq7FINvfIhZAyjE1EceQ2 GzJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=GfkCMu+Y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wp.pl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu10-20020a17090b1b0a00b001f7299d9c0fsi11916770pjb.59.2022.08.15.00.51.13; Mon, 15 Aug 2022 00:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=GfkCMu+Y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wp.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233308AbiHOHoX (ORCPT + 65 others); Mon, 15 Aug 2022 03:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231517AbiHOHoV (ORCPT ); Mon, 15 Aug 2022 03:44:21 -0400 X-Greylist: delayed 398 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 15 Aug 2022 00:44:20 PDT Received: from mx4.wp.pl (mx4.wp.pl [212.77.101.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252CA19291 for ; Mon, 15 Aug 2022 00:44:19 -0700 (PDT) Received: (wp-smtpd smtp.wp.pl 4484 invoked from network); 15 Aug 2022 09:37:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1660549057; bh=jhDqEhiGM+n8Cdl5DAdtoFPYD0xgBQR3XpaUP79LM9o=; h=From:To:Cc:Subject; b=GfkCMu+Y9FHE5xxLiIPovPxyjLJCOaByYtofnCLBvi1sGZJrjACPrKFdHUcCq9XRR 8ZyTv4mAwKRHVu7UEmpOqB7axS599H7iGMoimnrH/ksVcesp14bf4GM/VHckE1/Jxe x9/c7zIT4d+zbWdGAAORvAZlzlDrqqh5wughbJwc= Received: from 89-64-7-186.dynamic.chello.pl (HELO localhost) (stf_xl@wp.pl@[89.64.7.186]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 15 Aug 2022 09:37:37 +0200 Date: Mon, 15 Aug 2022 09:37:37 +0200 From: Stanislaw Gruszka To: Sasha Levin , linux-wireless@vger.kernel.org Cc: stable-commits@vger.kernel.org, aleksei.kodanev@bell-sw.com, Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH 6.0] wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in il4965_rs_fill_link_cmd() Message-ID: <20220815073737.GA999388@wp.pl> References: <20220813203952.1914688-1-sashal@kernel.org> <20220814075703.GA847900@wp.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-WP-MailID: 064f9660f89dc8f74b4942be8fd80768 X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 0000000 [IeMB] X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This reverts commit a8eb8e6f7159c7c20c0ddac428bde3d110890aa7 as it can cause invalid link quality command sent to the firmware and address the off-by-one issue by fixing condition of while loop. Cc: stable@vger.kernel.org Fixes: a8eb8e6f7159 ("wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()") Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c index c62f299b9e0a..d8a5dbf89a02 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c @@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, /* Repeat initial/next rate. * For legacy IL_NUMBER_TRY == 1, this loop will not execute. * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ - while (repeat_rate > 0) { + while (repeat_rate > 0 && idx < (LINK_QUAL_MAX_RETRY_NUM - 1)) { if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; @@ -2422,8 +2422,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, cpu_to_le32(new_rate); repeat_rate--; idx++; - if (idx >= LINK_QUAL_MAX_RETRY_NUM) - goto out; } il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, @@ -2468,7 +2466,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, repeat_rate--; } -out: lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; -- 2.25.4