Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2161883ioo; Mon, 23 May 2022 11:33:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoDYe5LLKgycz/WFo+6MiYchb/4AJp6pAr2Ienkp+ahll2R07QrQf+GMp6+BCYmwBEcrpI X-Received: by 2002:a17:903:1cb:b0:162:1aa9:f554 with SMTP id e11-20020a17090301cb00b001621aa9f554mr8224405plh.152.1653330808471; Mon, 23 May 2022 11:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330808; cv=none; d=google.com; s=arc-20160816; b=JFhNvhQXQq6f7q5EIc3/kVafj1/5UMfMIuZVewa5mCyp0c7PzF+f4ochjB+gZtA89N D+rKokB4/1wM+zr6J5bwuqNKkK/zU0qE+PtiN6wLPwBZ0y2Qgcz8kN1bqPGkBSfQQ3KF 8xU4KNE9iByq7qGRigyPc3NWbX1x1nUhx3KfnsLA6raJPsn3mcy07FSYA8IBkQ4tOisr B785hfSDxOIy62lwnEAt+IkqmbtwnB1Z8uJNbZWksa4qZT5elBDp7k9ToH2lbhlE2orS 0UdhYhpOE6N5bQf8V/4UoINxrPpUuJMESDIcKHRXWgIbGOIci8cuzpzRaX6b0QQzPf7E 0UsA== 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=GuZBtoPTGDJEnwUOGq8yKJ4HjjfYw8JGTKhvozUVsLA=; b=bTlxlKCsw3Y7v10BaZ2OzF5iI2ARsvlr44u6vp35ppCl/XoDf3DM4QZkKG0wfNF93C WmChTrG5XsH9N8aYD3hpCWIrPluIjqUiU9xEtyi4c59pAtuXJ3niEEovFxk3LLoOuBtk ukwlG6Y0JEC3ZG4nfmMuwkfNc5bw0nSTiWYILn1kB5pw+K5jsf/BL3b+HX3oabKmDaok QtdrNDp4qpk3Gi00JFmNCBU+f36c1L2SIGWSFqvbGhhzHf3s1VaLDQhxrDQ1HYTV3nGQ 8XBk3RDYbQXQ9Jr+ipx7+nUALc2BGAOBBSqe36WBSa8EqkTFfBZ8FC/sDq5vTSlGWwOd OLwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a3id5fkh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j7-20020a17090276c700b0016152774876si10305458plt.144.2022.05.23.11.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:33:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a3id5fkh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B1A87520F; Mon, 23 May 2022 11:31:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244491AbiEWSGi (ORCPT + 99 others); Mon, 23 May 2022 14:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243481AbiEWRiP (ORCPT ); Mon, 23 May 2022 13:38:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C61190CE3; Mon, 23 May 2022 10:32:18 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9F50EB81208; Mon, 23 May 2022 17:09:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA465C385AA; Mon, 23 May 2022 17:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325753; bh=4otzz0Ek9YgjFM5VEIzznDR47c+nrHLEJbYejAR82I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3id5fkhHbEI81RpNsCIE1g9pjd8w1/Ae4PF1b58LzOhCHXDUFB270jgbNifC1oD9 A+YHwyPmYwfVZ+V1IfNKkNt56uwapTcMR4ihdbY1IMuSkCFg+HnH03k0qAXzRayjGY fKUSw3MdhIZSb+x+vJRoyW+AvQ03suvO9luxGPhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aashay Shringarpure , Yi Chou , Shervin Oloumi , Grant Grundler , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 31/33] net: atlantic: verify hw_head_ lies within TX buffer ring Date: Mon, 23 May 2022 19:05:20 +0200 Message-Id: <20220523165753.403273785@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165746.957506211@linuxfoundation.org> References: <20220523165746.957506211@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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-kernel@vger.kernel.org From: Grant Grundler [ Upstream commit 2120b7f4d128433ad8c5f503a9584deba0684901 ] Bounds check hw_head index provided by NIC to verify it lies within the TX buffer ring. Reported-by: Aashay Shringarpure Reported-by: Yi Chou Reported-by: Shervin Oloumi Signed-off-by: Grant Grundler Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index 1c1bb074f664..066abf9dc91e 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c @@ -625,6 +625,13 @@ static int hw_atl_b0_hw_ring_tx_head_update(struct aq_hw_s *self, err = -ENXIO; goto err_exit; } + + /* Validate that the new hw_head_ is reasonable. */ + if (hw_head_ >= ring->size) { + err = -ENXIO; + goto err_exit; + } + ring->hw_head = hw_head_; err = aq_hw_err_from_flags(self); -- 2.35.1