Netdev List
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Florian Fainelli <florian.fainelli@broadcom.com>
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
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	[thread overview]
Message-ID: <eab2af85055e2096fb5d28db18860b0f@tipi-net.de> (raw)
In-Reply-To: <20261008210621.1374785-7-florian.fainelli@broadcom.com>

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

      reply	other threads:[~2026-10-09  8:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 21:06 [PATCH net v2 0/6] net: bcmasp: Collection of fixes Florian Fainelli
2026-10-08 21:06 ` [PATCH net v2 1/6] net: bcmasp: fix mib counters struct alignment with ethtool stats Florian Fainelli
2026-10-09  8:42   ` Nicolai Buchwitz
2026-10-08 21:06 ` [PATCH net v2 2/6] net: bcmasp: unmap previous DMA mappings on TX map failure Florian Fainelli
2026-10-08 21:06 ` [PATCH net v2 3/6] net: bcmasp: validate minimum RX packet size in bcmasp_rx_poll() Florian Fainelli
2026-10-08 21:06 ` [PATCH net v2 4/6] net: bcmasp: fix OF node reference leak for phy_dn Florian Fainelli
2026-10-08 21:06 ` [PATCH net v2 6/6] net: bcmasp: fix network filter lookup and wake filter pair allocation Florian Fainelli
2026-10-09  8:55   ` Nicolai Buchwitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eab2af85055e2096fb5d28db18860b0f@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=ryotkkr98@gmail.com \
    --cc=zakkemble@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox