Article View: linux.kernel.netdev
Article #1132Re: [PATCH net v2 6/6] net: bcmasp: fix network filter lookup and wake filter pair allocation
From: Nicolai Buchwitz
Date: Fri, 09 Oct 2026 08:55
Date: Fri, 09 Oct 2026 08:55
58 lines
8023 bytes
8023 bytes
Hi Florian
On 8.10.2026 23:06, Florian Fainelli wrote:
> In bcmasp_netfilt_get_init(), when looking up an existing filter
> (!init)
> for a specified location, if the filter at loc was not claimed, the
> previous loop continued searching higher indices and could return an
> arbitrary unrelated filter belonging to the port. This caused flow get
> or
> delete operations on an empty rule location to return or delete an
> unintended filter.
>
> Fix this by checking only the requested location on lookup and
> rejecting
> RX_CLS_LOC_ANY when !init. In addition, harden wake filter allocation
> and release by ensuring wake filter pair searches stay on even
> boundaries
> where both entries are free, checking that loc + 1 is free for
> positioned
> wake filters, and validating parity and bounds on release.
>
> Fixes: c5d511c49587 ("net: bcmasp: Add support for wake on net
> filters")
> Assisted-by: LLM
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> ---
> drivers/net/ethernet/broadcom/asp2/bcmasp.c | 121 +++++++++++---------
> 1 file changed, 70 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> index 972474893a6b..b6a201982080 100644
> --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> @@ -511,6 +511,13 @@ static int bcmasp_netfilt_wr_to_hw(struct
> bcmasp_priv *priv,
> return 0;
> }
>
> +static inline bool bcmasp_netfilt_is_companion(struct bcmasp_priv
> *priv, int i)
nit: Does it need to be inline? Usually the compiler takes care of this
automatically.
> +{
> + return i > 0 && (i % 2) &&
> + priv->net_filters[i].wake_filter &&
> + priv->net_filters[i - 1].wake_filter;
> +}
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
Technical Details
Message-ID:
<eab2af85055e2096fb5d28db18860b0f@tipi-net.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343532-linux-kernel-netdev=dewy.ruReferences:
<20261008210621.1374785-1-florian.fainelli@broadcom.com> <20261008210621.1374785-7-florian.fainelli@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343532-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 6/6] net: bcmasp: fix network filter lookup and wake filter pair allocation Date: Fri, 09 Oct 2026 10:55:05 +0200 Organization: Usenet Network Message-ID: <eab2af85055e2096fb5d28db18860b0f@tipi-net.de> References: <20261008210621.1374785-1-florian.fainelli@broadcom.com> <20261008210621.1374785-7-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1068466"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:arASD7aOduybT+45sIQ/XMG4t7c= sha256:AXa2ZcxQQJeD4AY7Nbs/mASEhggtJXaDxMbJemTrgYE= sha1:3rBNTb+2LIwH40KZF06xMoMMZBY= sha256:rR6QZxH0vGso4xj860iWiAiIDckrFS7cp4eXXAJvMcs= 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 BBF8D10F61F; Fri, 9 Oct 2026 11:57:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -0.751 X-Spam-Status: No, score=-0.751 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de 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 Uk1bBR9vN8MA; Fri, 9 Oct 2026 11:57:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-343532-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 61A1D10F0B0; Fri, 9 Oct 2026 11:57:41 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 3A37F28A34; Fri, 9 Oct 2026 08:55:14 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DB123CEB9D; Fri, 9 Oct 2026 08:55:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="FR36wPfz" X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97CF837F00D; Fri, 9 Oct 2026 08:55:09 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791536113; cv=none; b=DkTi8yvGczVageUQlqD50BFwEU60sB9zpL1uUAfABLwByMcsJQwmzptgzjQZV3gplk7LRNZBRtHkJMIdhtDH62ybMBmjWXavvprJIXU+D2R67+BMs9PAYJzP7MOGF6Xhxqov8hYXkMRxf2X6Z2kG+Od1GLooTfO7EKer+uQHfmk= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791536113; c=relaxed/simple; bh=M/772MkfjZxcZxdMFw08GIOdq6kwRPrIVPBEqXSBW6Q=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=pvT7NxWP3dCuXqJNCjZGjzuqQ/kJqRkRvBzGQTZnG+c6wn4+UWiWqbV9NVErBdXPb3dwTRx00DDfVgaOnXDwowayh0gSMjlbdsNWO9MaCGXgKJDvpsW1gnEVev95EjP4DulHRgAcFsagVNjfUqtgJKEkRCO1qC98nW3bPIHk08c= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=FR36wPfz; arc=none smtp.client-ip=194.13.80.246 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 91533A1546; Fri, 9 Oct 2026 10:55:05 +0200 (CEST) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1791536106; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=IjYswT14LA0G5bCkxr3uocVn1ohEeOrTPJe/VBLRec4=; b=FR36wPfzdJIXMnFWr4kFm5yec1kmgM2TrnWrw91tT8Fx1I5cc8iEKPEzyhR7XSG5hyRyRO TLa89Xd8iSVSBCGP5gF0AB5Ism1NozLiHH3uzS9V+IC7iXCH+0406JVlLx59AeJl2VJ6Um eb5Cly3pu4OzbC9VX0liVopXRHCgEc4HSSorhIuPUCzwI/RgKBvURRwUYWFnQ4Vz+wlQxy O8EC5pM2lRyEBAVpVF7dTc/MEtZj/gps2jb3Tz02agkS2BLBYDj4ngGfLtmC8bwetx6WuG RoLp5Fzn4y0aoy8sk5suMerHxvCJgqk3x25qjEZm0irBFERhcmiJk/CKfEZ8hQ== X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-Cc: netdev@vger.kernel.org, Doug Berger <opendmb@gmail.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Zak Kemble <zakkemble@gmail.com>, Simon Horman <horms@kernel.org>, Ryo Takakura <ryotkkr98@gmail.com>, linux-kernel@vger.kernel.org X-In-Reply-To: <20261008210621.1374785-7-florian.fainelli@broadcom.com> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3