Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3688442lfo; Mon, 23 May 2022 11:29:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBYKM79mxZYqIK+dVcbs34lD09tMVxf5ftMxHt0Ye/IQHz8gPwCK0E/VpevBJMhpYNjPnx X-Received: by 2002:a17:90a:3b07:b0:1de:b43f:f976 with SMTP id d7-20020a17090a3b0700b001deb43ff976mr332584pjc.192.1653330581499; Mon, 23 May 2022 11:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330581; cv=none; d=google.com; s=arc-20160816; b=E+lOQSuSfHol4K7iJ40fZYzd+2HUvIbKVK8AgzV2GY/nPQrM923bLjIpNjXk/3heVi 8DVMZhVtG35e2OvGYp/fO2XfBbfQ6iA08lqPvW+OQ9oQiUuCqOxQRSvLTLyemG2DFztW UOqlY5caX+ZSuY7pDXC3YCM5gJDJ9A8FGsSUjE+bttJGO0SWrFWfykgxMA1e7vWqKfyi JcIJJJ+rYCr5wisaFAHchD6R0wFmS1hHuflJu+B5QZ1XPs1iQZWMO03YINhsuhFFvV2D lObqecxX5XQ9UuzXztLUo+6ark1rn1+VERjbYoOA12jHVOu1g7fDKGyZ8xt+wfAJh+v5 c7dw== 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=7rt8XA7yJ8I2I2n3C14ZHZiZ+Wk6JNkTBiGKa8wWcyo=; b=UP0aSYwSpnBJHemInXimKVRk42NApFlptjjgL5PdfagHsLaM/SMitXl2Zq7zSMfHuC Mwb2+/pcm0RSpa5ld4i28FXxWJ7sLUc50g47p2PQRiD6Y16i+i9A4RxaAM4PshulTcv1 I7C1QpxO6nDwXW7oBMJn4iGieWAU9T2Cr+lfu4GUGH5vcspTCPATMlMBHeei77MMAuJF oT036Qa8ewE1uhaj/WGR6N/BIMenYmRuQBAPaCSiwEc3X75JeEav+xvoCUqr0CU1XFzJ E/Ckc9HEQbHNgV/Jbes5UVES7JwNIHPw88saIqxIdsRv2702FOLZN4eZX2Uq62+wqS8z De3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i3v9gkTO; 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 f6-20020a056a001ac600b005103895dae4si15061970pfv.316.2022.05.23.11.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:29:41 -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=i3v9gkTO; 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 B1220135696; Mon, 23 May 2022 11:29:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239926AbiEWRSn (ORCPT + 99 others); Mon, 23 May 2022 13:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240147AbiEWRP2 (ORCPT ); Mon, 23 May 2022 13:15:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D38760CA; Mon, 23 May 2022 10:12:41 -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 EF616B81201; Mon, 23 May 2022 17:11:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4783FC385A9; Mon, 23 May 2022 17:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325892; bh=BUNLhRfompu2Orpy6NY8TgsXhVZK+k4CPtKbD4EVduU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i3v9gkTORiGsDNe9vqkHQkJC3NES/wcjrR6bYRbD8fD0r5isxzflJG35rWQZYJ8bH bmKmCVt4wDPeIvuVFj19Gu0/mSkzn+uTWGUL3vtf28YBKPtobIpo7B8n7wJmHj8mqo RPPU64k3l+d7o9T4rCjsBlhaIkQbUM6gBk2pp54E= 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.19 41/44] net: atlantic: verify hw_head_ lies within TX buffer ring Date: Mon, 23 May 2022 19:05:25 +0200 Message-Id: <20220523165800.814384078@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@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 c4f914a29c38..bdb0b37c048a 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 @@ -637,6 +637,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