Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2117732ioo; Mon, 23 May 2022 10:25:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX/6jgdkzkS2fGkPuL0Eg2lbAwKKr+FKVEDPUEfpMVFfQSbFjpeD0eLo/K2dNYl/W30LdG X-Received: by 2002:a17:90a:4587:b0:1de:c6ee:80f with SMTP id v7-20020a17090a458700b001dec6ee080fmr83896pjg.196.1653326758598; Mon, 23 May 2022 10:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326758; cv=none; d=google.com; s=arc-20160816; b=buayGBYyz+U7IHkrbuCR9GNUm1IZYUcSRUP6/p7gBRy2kMWBWMzxq9YrBYqAVDB21o PeRNH2LiR9Rd98gvAk8OFxsli/kODauJalvzwR8m1CEk1GcwNF1a9jy9WZxtwdNjVFIe eMkJrf0Q3AiMvVOOetQGO5BtxKF6kqegCVVTBHT1Wk8z/iPgtWnAuOlj/m9gCTyOclNV 2WaqHX8siMmVDjFBbtzmPzfgXuAh67IJYYWly2KUbW3wEDtpBz/Agr1UAPAG9hmjq0LW F77SAVTatxijbQKD7Gichof2VGFc9G3JgqDpi52HpGTVI7jHPtf1SpUWjlofn37ZGhYr XsdQ== 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=MBrYWyjiMpQk8mu8X/NrAfOC9XG63b8oEJ6F2w09BGA=; b=XgpsvDNsFNJ1hcIZw8jsZ+ZrzVLeLVW45z+fIntJNELn3agN096nzpAJlNvKuDEJIe OeKMneFx0AGZzjFOLLQFIB5Qf+vo6ir5PjrmPzt0l5Pm6YDk5GICL+DrDJrihW7tMB7b 6TQtY51duvSYEKLkOHYs5dcwVg2gr0jfuSQtR5QbPN/gLeTjlybBsHLl0z6FyWDh1KP4 iua3Ypakgd3mVjZycEr33k2uf8ab3v0TP1xUdX82j6Zm/Q04gkMnnv6D+uVZOAkmM3vI 5AYQ7fy8YBLG/yPIvnJTnPYVLjtuHszG2c+9scTKlEZ3r52JD2PqLU8VM2pyvUR6Zuwg o0MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B1Fu40Hf; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id f125-20020a636a83000000b003db43fa2ed3si10602757pgc.713.2022.05.23.10.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:25:58 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B1Fu40Hf; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 227C28217F; Mon, 23 May 2022 10:25:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240279AbiEWRUL (ORCPT + 99 others); Mon, 23 May 2022 13:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240799AbiEWRQn (ORCPT ); Mon, 23 May 2022 13:16:43 -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 538AE5E16E; Mon, 23 May 2022 10:16:31 -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 8360360B35; Mon, 23 May 2022 17:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A4DDC385A9; Mon, 23 May 2022 17:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326171; bh=Bn5iKQ4JY22ozgqp12txf8GMnQ2eSsU/MfN2HFCD7Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B1Fu40Hfznjn4Dh2QEqjwVmMorDgwheQXCFUgC00+uBvFrjAKAIgiX9hyqZ4eQ5FI a7qi3/jnzsbPDWbHrQbpjwWE75GLGuOWw5go5sCLfvcBiVHbv73qQeJL/o2dIE/h4u K6BcqvW5jADRBKsDeMQGw+HbFpHpqfZjc5P20zmA= 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 5.4 58/68] net: atlantic: verify hw_head_ lies within TX buffer ring Date: Mon, 23 May 2022 19:05:25 +0200 Message-Id: <20220523165812.049024883@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@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 2ad3fa6316ce..cb5954eeb409 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 @@ -674,6 +674,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