From nobody Mon Feb 9 01:44:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 615DAC43217 for ; Mon, 23 May 2022 18:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244525AbiEWSGk (ORCPT ); Mon, 23 May 2022 14:06:40 -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-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/dr= ivers/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 =3D -ENXIO; goto err_exit; } + + /* Validate that the new hw_head_ is reasonable. */ + if (hw_head_ >=3D ring->size) { + err =3D -ENXIO; + goto err_exit; + } + ring->hw_head =3D hw_head_; err =3D aq_hw_err_from_flags(self); =20 --=20 2.35.1