🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23924

Re: [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid

#23924
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 15:39
82 lines
11380 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In hw_atl2_utils_get_filter_caps()
  (drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c,…

--

net: atlantic: AQC113: Ensure L2 filter count is valid

This commit checks the firmware-provided l2_filter_count in
hw_atl2_utils_get_filter_caps(). If the value is outside [1, HW_ATL2_MAC_MAX],
the count is recomputed from the already validated l2_filters_base_index.

> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
> index dc9b2ef4640b1..9ad5bbb11bdf8 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
> @@ -629,6 +629,8 @@ int hw_atl2_utils_get_filter_caps(struct aq_hw_s *self)
>  	if (priv->l2_filters_base_index >= HW_ATL2_MAC_MAX)
>  		priv->l2_filters_base_index = HW_ATL2_MAC_UC;
>  	priv->l2_filter_count = filter_caps.l2_filter_count;
> +	if (priv->l2_filter_count < 1 || priv->l2_filter_count > HW_ATL2_MAC_MAX)
> +		priv->l2_filter_count = HW_ATL2_MAC_MAX - priv->l2_filters_base_index;

[Severity: Medium]
Should the upper bound here be HW_ATL2_MAC_MAX - l2_filters_base_index
instead of HW_ATL2_MAC_MAX?

The fallback treats the count as the number of slots from the base to the
end of the 38-entry table. The accept condition does not apply that bound,
so a count that does not fit after the base still gets through.

For example, base = 30 passes the base check (it is below 38), and
count = 38 passes the new check.

Later patches in this series use l2_filter_count as the bound for
multicast programming:

hw_atl2_get_multicast_address_max():
	return min_t(unsigned int, priv->l2_filter_count - 1,
		     AQ_HW_MULTICAST_ADDRESS_MAX);

hw_atl2_hw_multicast_list_set():
	if (count > (priv->l2_filter_count - 1)) {

With base = 30 and count = 38, this advertises 32 multicast slots. The
loop then writes slots base_location + i, which is 31..62.

The register addresses are linear in the slot index:

	#define HW_ATL_RPFL2UC_DAFLSW_ADR(filter) (0x00005110 + (filter) * 0x8)

Slots 38..62 would land on MMIO 0x5240..0x5304, which is past the L2
unicast filter block. Can this misprogram unrelated RPF registers?

In the final series, hw_atl2_hw_packet_filter_set() clamps with
min(HW_ATL2_MAC_MAX - base_location, l2_filter_count - 1). The multicast
paths above use the raw l2_filter_count without that clamp.

Something like this would give every consumer the same window:

	if (count < 1 || count > HW_ATL2_MAC_MAX - base)

The Apple firmware reports base = 9 and count = 29, which is consistent. So
this only applies to firmware that reports a mismatched base/count pair.

>  	priv->etype_filter_base_index = filter_caps.ethertype_filter_base_index;
>  	priv->etype_filter_count = filter_caps.ethertype_filter_count;
>  	priv->etype_filter_tag_top =

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-0-b5efbc124dcc%40jannau.net
Technical Details
Message-ID: <179588034739.3135.6933254779227340437@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373194-linux-kernel-netdev=dewy.ru
References: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-1-b5efbc124dcc@jannau.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373194-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid
Date: Sat, 28 Nov 2026 15:39:07 +0000
Organization: Usenet Network
Message-ID: <179588034739.3135.6933254779227340437@kernel.org>
References: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-1-b5efbc124dcc@jannau.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="978253"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/V7k7XIUr93LX25rn+FuvyYHGSw= sha256:1r6PPHNV2v5ksRBf/F1GeO8bVuh/0jusydQpW1OlOjQ=
	sha1:3xWfVR4HELZVsVTS9icWBd+H970= sha256:oj5JMwknhKWfcK97OfJrc16AlyR8X8WZIYZQrDSCt88=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B419E125F85; Sat, 28 Nov 2026 18:39:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 19v3rDz8_VYk;
	Sat, 28 Nov 2026 18:39:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373194-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 7174A125F76; Sat, 28 Nov 2026 18:39:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 0A9B128DFB; Sat, 28 Nov 2026 15:39:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795880349;
	b=1qdQGcCYsg0mw1AQdyZynGgS6DcQlf9pX3f2dxpzikH6M++P+o4TYU2gmNO57BoURr8R
	 mxnPELYzZm9kVpzTsHMtE7vDort+UC9j9NdP/Ab1v1aMOAsu16ldKC35tV9JC3Wqc5rnr
	 WMiqhYv9eZ27Uv2v4z9iksNWl3ha3fsEy4cqSvOlwY1MrL0RMTB1zWtEc6EFI3HhdNmw4
	 zpnXtqvBal1/f5EcKPPlTgOI0qYzbOPpzoehEZWzDLEy8PLMgCS3UtQrSthXRHbVp1uOZ
	 FRS8CqC/Fr+W7aRn4Z4+XiCInKOCDjRg0DoiSdCK227Zuy154jCNDf3aInqbQJaTIBg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795880349;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=Fmy4rzhXADrFx5343JuQbx0N6B9LmQdVdPfeQBW7Weo=;
	b=QoEwKveIU1bZCLWp550/wCYkn+NDIA2V72wY961qFXRaQuTrrEootMUfHwAWiJkmX95x
	 xBvFnPLZpzBJCSX6xfj4Cyno/EGcPQCKMS5G+4M7f8BOrqJBG1yu8x0Vd7xsLcB05pe88
	 RVOrL3d30pcCnkSSPoM9zhVzpEvBrSQLnA9ZTCUb2vzGaOGGFfOxkyEWzhpv2vIBEIk/e
	 QWDq6dF+a3TNJVOKxaoZhjza/KYRKgXcQ8nynOrHFpHdAMyK3eoHLu5yuNKa6UbJVgv0b
	 +idehEv/oDeqHygU+2BgGvd3DTbl3jFF9vV1EAiBsE6YwsTu4yqaWM4eyrde2dCGCsQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T4HLycHz;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id AD776606A32A;
	Sat, 28 Nov 2026 15:39:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T4HLycHz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795880348;
	b=ZqZy5BDEWo/fX9VLyJ6uTYfiVnMuNIGN6BBvq3bCE35w0ApCDVlPzEwREJ6QRYdl+URB
	 e3Bo+2BP0wTaJsYHAanvEOAtosb0LCSD2jGqsF/jD2F0/4aUvh+6mEbgSaIZ1iEmluZAF
	 ey7/P8Ez1jCIec/B1piSgvQC4utgvcEYy/md5w9D1za0Bj3+8qNSLC37BMBAR5xXy7Jux
	 DpXN34MWUwshCCAIjvfNgtglK16z4Trvq8+ZB+g/do50ez6QpooZ1xxahjXWXDKcOzr0v
	 J7wmW+nmJUC1dHBDIhLNi5nrD+7AJPq9huJf/L2HX8SLStzxIkf5DdPnKJ1r4YljpTw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795880348;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=Fmy4rzhXADrFx5343JuQbx0N6B9LmQdVdPfeQBW7Weo=;
	b=vvxXB8Gn2u0ugDPyUuDyf7bp9aS1I8pyINMxFcv9qyiHEUjZKg4LRaPajuq24UbyIbYT
	 lcWy2l0xnd+e6ZhWvPdAiRjNiwwTEtk8GRfgDjAubZRoSqNV1a+7hDeaMqBgRsYJgAIE9
	 aQ+r7HajaRRRv4o0M+Y6rAR2mnPhVcObqYYMXHSh70MPsNsTMWwW5qS0keQm+1NJSPQRs
	 LkoFCPzvPNLUgwXJGl72IQqALYLAP0nju78BqrET/MYua0gINV50lLVKVFvmpj749UAr3
	 Esisrd27cxOjZFoCx2w6RQ3UsqjcEtQboSbXRdLCu9OXlKufDREl6nLCqJqO3lbETpQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T4HLycHz;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB0E4606A31C;
	Sat, 28 Nov 2026 15:39:08 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9B5E1F00897;
	Sat, 28 Nov 2026 15:39:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795880348;
	bh=Fmy4rzhXADrFx5343JuQbx0N6B9LmQdVdPfeQBW7Weo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=T4HLycHz+E9dYAD4kDKrJ99qUUlZbBlt7F9Lbcasa8pC0wGPZK5AT0diEyk+6EBdN
	 Ue9nMuYqHfpQmNxpCciq+fzgh2FFENBLixHsR6MErCpQYmH/oJeHcemsGbsdXlwT4K
	 ZxfHICQTe2OedD+rSr4JWtdm0l+BO4a3OHyfpFtnprH29vJ7Qj3QMM1NmXyhDyspOL
	 MQ1hIw+pqxbQb93tvnjy6I2zREhw7tXMcb6DUSoOiBPXm+x38BfVnCUDNxpL2e0unE
	 5/aB8cjX9uCgrpNvrqQe+YVLPjK/yOXMiRBmEXsl52dxY3hG8xgzVwKoctKNJCSrDe
	 GjypCfOIPO+Ng==
X-Cc: sukhdeeps@marvell.com, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org
X-In-Reply-To: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-1-b5efbc124dcc@jannau.net>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list