mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: netdev@vger.kernel.org, Cursor <cursoragent@cursor.com>,
	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 4/8] net: bcmgenet: clean up RX NAPI on bcmgenet_init_rx_queues failure
Date: Fri, 18 Sep 2026 12:43:43 +0200	[thread overview]
Message-ID: <d8b67a2402ec38f7cb374c5b223afb81@tipi-net.de> (raw)
In-Reply-To: <20260918000732.276506-5-florian.fainelli@broadcom.com>

Hi Florian

On 18.9.2026 02:07, Florian Fainelli wrote:
> bcmgenet_init_rx_ring() registers a NAPI instance for each RX ring via
> netif_napi_add(). If bcmgenet_init_rx_queues() fails while initializing
> subsequent rings, bcmgenet_init_dma() frees the RX buffers and page 
> pools
> but fails to clean up already registered NAPI instances with
> bcmgenet_fini_rx_napi(). This leaves stale NAPI structs on the 
> net_device
> napi_list.
> 
> Call bcmgenet_fini_rx_napi() in the error handling path of
> bcmgenet_init_dma() when bcmgenet_init_rx_queues() fails.
> 
> Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
> Assisted-by: LLM
> Co-authored-by: Cursor <cursoragent@cursor.com>
> Change-Id: I45982e0e198a44f3f56b1300f462870462b81108
> ---
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c 
> b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index bfb74dca55d6..ef155a170fa6 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3167,6 +3167,7 @@ static int bcmgenet_init_dma(struct bcmgenet_priv 
> *priv, bool flush_rx)
>  	ret = bcmgenet_init_rx_queues(priv->dev);
>  	if (ret) {
>  		netdev_err(priv->dev, "failed to initialize Rx queues\n");
> +		bcmgenet_fini_rx_napi(priv);


napi->dev is still NULL here, bcmgenet_init_rx_ring() only fails before
netif_napi_add().  netif_napi_del() does netdev_lock(napi->dev), so this
oopses on -ENOMEM at first open.

rx_queues is 0 in all hw_params anyway, so there is nothing to clean up.
Drop this one?

>  		bcmgenet_free_rx_buffers(priv);
>  		bcmgenet_destroy_rx_page_pools(priv);
>  		kfree(priv->rx_cbs);

Thanks,
Nicolai

  reply	other threads:[~2026-09-18 10:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  0:07 [PATCH net 0/8] net: bcmgenet: Collection of bug fixes Florian Fainelli
2026-09-18  0:07 ` [PATCH net 1/8] net: bcmgenet: fix 64-bit RTNL stats reading in ethtool on 32-bit systems Florian Fainelli
2026-09-18 10:13   ` Nicolai Buchwitz
2026-09-18  0:07 ` [PATCH net 2/8] net: bcmgenet: initialize u64 stats seq counter for all queues Florian Fainelli
2026-09-18 10:13   ` Nicolai Buchwitz
2026-09-18  0:07 ` [PATCH net 3/8] net: bcmgenet: do not skip WoL power up on GENET V1 Florian Fainelli
2026-09-18 10:16   ` Nicolai Buchwitz
2026-09-18  0:07 ` [PATCH net 4/8] net: bcmgenet: clean up RX NAPI on bcmgenet_init_rx_queues failure Florian Fainelli
2026-09-18 10:43   ` Nicolai Buchwitz [this message]
2026-09-18 17:39     ` Florian Fainelli
2026-09-18  0:07 ` [PATCH net 5/8] net: bcmgenet: acquire ring lock with BH disabled in bcmgenet_dump_tx_queue Florian Fainelli
2026-09-18 10:57   ` Nicolai Buchwitz
2026-09-18 17:40     ` Florian Fainelli
2026-09-18  0:07 ` [PATCH net 6/8] net: bcmgenet: validate Ethernet address in bcmgenet_set_mac_addr Florian Fainelli
2026-09-18 11:00   ` Nicolai Buchwitz
2026-09-18  0:07 ` [PATCH net 7/8] net: bcmgenet: zero-initialize Transmit Status Block in bcmgenet_add_tsb Florian Fainelli
2026-09-18 11:03   ` Nicolai Buchwitz
2026-09-18 17:41     ` Florian Fainelli
2026-09-18  0:07 ` [PATCH net 8/8] net: bcmgenet: mask DMA_TIMEOUT_MASK when reading DMA_RING0_TIMEOUT Florian Fainelli
2026-09-18 10:13   ` Nicolai Buchwitz
2026-09-18  0:12 ` [PATCH net 0/8] net: bcmgenet: Collection of bug fixes Florian Fainelli

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=d8b67a2402ec38f7cb374c5b223afb81@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=cursoragent@cursor.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

all inboxes | Powered by JetHome®