Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6769986rwn; Tue, 13 Sep 2022 08:47:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4M5JMS2tiJTOObsQvHFanpOG79b6pjWpkQ3fhmD1/u7eWKtGqds07VRCZCA8GJQBXzDbj+ X-Received: by 2002:a63:69c7:0:b0:41c:590a:62dc with SMTP id e190-20020a6369c7000000b0041c590a62dcmr27255273pgc.388.1663084071591; Tue, 13 Sep 2022 08:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663084071; cv=none; d=google.com; s=arc-20160816; b=HwOj+MGfHRDhpRLTXP1YGQZF/9tGwcqVffCaC1DKoXL3Vti7uNjhuD/vggfQtBFQ0y x7J58OB0yYTLjKYLs/5J8u89MTCD8WyMnEgq4iU496uw3awPpxhmN2Awu/4rsJaCXOkT WzokpxAi2XfBRl8ZAFPRoJ68xVvI/mcpRcwiZYwFYfCK+aEMxKif+m8F4G2McRRAymFd CynNWxDl4O5v0E+LeJhr27jAVe/7G5e4AQoo+a+MYKuvTXc7ZeOnDBo+bbvckkwPpAyY JUkrS0R9mjzIekh9I+gCuXD1cbYJa9oKIaEQZOENiGZ7JNKHG2Ewa4vy8+Ma+DyE0zos ZOkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sp307gFRwdtlbrGt/3JhNX5sPs4NWX59EmNkquxjvVc=; b=vFddGShhhRu9OF7p9u94iPwbfwP2CSXsyb9jzkkA+LtKisrfXnn8Hpx0ZPZdhId/0W qfRgNuHAbMGdnIOTwUiAQrXJaVfpmq22leNxqxX2U3uuL0Z1/Lu0zm/NTnFaS9lA6M8y djSCMmpmQWGgiQoioZ4fmr/Upu0F78Md8bzUzUNxeaqanQ9umsOMDOwubKmUJQOvowov v94wxaN29pp41BZPH7/yyNomE8SM/encf7TvRkxuyI7syE1o82OX71jJ+VAXli0FgBVm wcSB/WlzvHX+/02cHa/1XeV+Gk0POWY86SNbFiIoR/foKhBl/yXx7KaBHKMhvMoJeWIR Uijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z5jgMslu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j16-20020a170902da9000b00176b3c7d158si3274163plx.99.2022.09.13.08.47.39; Tue, 13 Sep 2022 08:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 header.i=@linuxfoundation.org header.s=korg header.b=z5jgMslu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232199AbiIMPXG (ORCPT + 99 others); Tue, 13 Sep 2022 11:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235950AbiIMPWT (ORCPT ); Tue, 13 Sep 2022 11:22:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A61267B78B; Tue, 13 Sep 2022 07:36:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 15426614E0; Tue, 13 Sep 2022 14:34:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2185EC433C1; Tue, 13 Sep 2022 14:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079683; bh=rV+n4kd+7BD+xatHr5rme8y5xnzaeFBry0keN3r8Rlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z5jgMslu3EH8ymxaAZWvaZZYdElf/C/s5kAiNpwr+jS+2GIAnn1gZ9G/bb6q+tNDb 98wbn3xjyEaSzJwudjnUkapGrDNT7YylHIO/0AS4/slpe9Y8Eh1nrlnM8pHhULLmv/ Pkrxijs5r4Z7at03bAzyGGZkogdbkio40celAgI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislaw Gruszka , Kalle Valo Subject: [PATCH 4.14 35/61] wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in il4965_rs_fill_link_cmd() Date: Tue, 13 Sep 2022 16:07:37 +0200 Message-Id: <20220913140348.244519936@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140346.422813036@linuxfoundation.org> References: <20220913140346.422813036@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org From: Stanislaw Gruszka commit 6d0ef7241553f3553a0a2764c69b07892705924c upstream. 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 Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220815073737.GA999388@wp.pl Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c @@ -2424,7 +2424,7 @@ il4965_rs_fill_link_cmd(struct il_priv * /* 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++; @@ -2443,8 +2443,6 @@ il4965_rs_fill_link_cmd(struct il_priv * 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, @@ -2489,7 +2487,6 @@ il4965_rs_fill_link_cmd(struct il_priv * 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;