Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp443148iog; Mon, 13 Jun 2022 06:06:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN0p7wfTIOUFmAGyv3uy7pGe45GA/yfvJHwmaDgDu6gSE8eC8VTcXwulqevchBDH7Dt4S4 X-Received: by 2002:a05:6a00:ad0:b0:4e1:2d96:2ab0 with SMTP id c16-20020a056a000ad000b004e12d962ab0mr59481716pfl.3.1655125589288; Mon, 13 Jun 2022 06:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125589; cv=none; d=google.com; s=arc-20160816; b=bQijcW2WqF6go53s/QbBAcI3x5gpIpa7bpTny66897VK+mh7iKNyODdAWvTUpv117p OB4vLRMMGBdZBNHiFiGz6RYYQImdfgTnw9VaZ9c9RSkwvZNE7nlIvf2vOjHVO7LEcHTF C8wkqxuLTVGbNZOzbqfNFjEGGB2NFt8hzreaZg4UPakyBYCkmBDV1AUA0eHKCgtA8z4A R3WDaMtuOCYUkI8//Bc2MgPI8Bo5jQvaxSjpBeV7voNudlIBJn6qGyv031crk9ET11IA bSPR2r2usXZqIHsT/dR05wCDD+6mmr/NrMcrHKJBUpBkznNAYv28LgLqgXd4NfNf7dnM oqdw== 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=1Ia29RLK57MEHiQDU9ABiLbonvE8/KBKbIyz05jOvXo=; b=a02U0mJGRTmFob298zyCIBybWxjAjjPBRtT3X8tKsc6oNcGvSs5u5coRKadF7Rcg3f IJeATGlw50GQG/ZzneYqpG9xbP6qVseVeox8s44oCVXlrnmUD18o1UZ+SmioEBMLJBgN PIMs1wiDoJCQDDToyKE3pK+km/59ZjnEWZ0h6kn7GrNuuTVLXU/H2XDps9V6yvOHw8lY zIuAIa/iFZnDxhPcrM5eNH+4avgOU5RTGUKKNx5ELcgrRVSZ3gt5iB3Usj1MvC/psc36 zxMGaDXQz/nfVVAT829i9p6SRXHOjzqFHu4If082uKtdnQjN1at0hEiywPomc4Dg3VOy wjGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vh9rkFfu; 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 t9-20020aa79389000000b0051c4e89e5easi9660603pfe.85.2022.06.13.06.05.54; Mon, 13 Jun 2022 06:06:29 -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=vh9rkFfu; 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 S245335AbiFMKpo (ORCPT + 99 others); Mon, 13 Jun 2022 06:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237635AbiFMKnT (ORCPT ); Mon, 13 Jun 2022 06:43: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 84EB92AC6A; Mon, 13 Jun 2022 03:24:19 -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 2454860F03; Mon, 13 Jun 2022 10:24:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36522C34114; Mon, 13 Jun 2022 10:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115858; bh=ae6omjMIf6MoErsJEh4Uefr1x4tAYvABToyamDT53fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vh9rkFfujfY1dkbfMo6oTX07dQhVqZlb2e8QHtwzVsJxEAATsqOkBUVRgoNvZPbF+ vVSrt6zc3m30+xzsVA+GdE5rvOwWZB7AjmrNVjQqpahu1hyByHnPesG8s//2Qk7U4n aVd/WgV+bo+cDIvf1BIlzN+cCR5x9WQEIDNFW+vk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 058/218] ath9k_htc: fix potential out of bounds access with invalid rxstatus->rs_keyix Date: Mon, 13 Jun 2022 12:08:36 +0200 Message-Id: <20220613094921.289060082@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 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: Dan Carpenter [ Upstream commit 2dc509305cf956381532792cb8dceef2b1504765 ] The "rxstatus->rs_keyix" eventually gets passed to test_bit() so we need to ensure that it is within the bitmap. drivers/net/wireless/ath/ath9k/common.c:46 ath9k_cmn_rx_accept() error: passing untrusted data 'rx_stats->rs_keyix' to 'test_bit()' Fixes: 4ed1a8d4a257 ("ath9k_htc: use ath9k_cmn_rx_accept") Signed-off-by: Dan Carpenter Acked-by: Toke Høiland-Jørgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220409061225.GA5447@kili Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 6782c3d0c333..e62ed7f42281 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -1005,6 +1005,14 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, goto rx_next; } + if (rxstatus->rs_keyix >= ATH_KEYMAX && + rxstatus->rs_keyix != ATH9K_RXKEYIX_INVALID) { + ath_dbg(common, ANY, + "Invalid keyix, dropping (keyix: %d)\n", + rxstatus->rs_keyix); + goto rx_next; + } + /* Get the RX status information */ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); -- 2.35.1