From: Simon Horman <horms@kernel.org>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: skalluru@marvell.com, manishc@marvell.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, ariele@broadcom.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] bnx2x: fix resource leaks in bnx2x_init_one() error paths
Date: Thu, 11 Jun 2026 16:32:56 +0100 [thread overview]
Message-ID: <20260611153256.GU3920875@horms.kernel.org> (raw)
In-Reply-To: <20260609074610.1968721-1-lihaoxiang@isrc.iscas.ac.cn>
On Tue, Jun 09, 2026 at 03:46:10PM +0800, Haoxiang Li wrote:
> bnx2x_init_one() falls through to the common memory cleanup path for
> several failures after probe has already acquired additional resources.
>
> If register_netdev() fails after bnx2x_set_int_mode(), MSI/MSI-X remains
> enabled. If later failures happen after bnx2x_iov_init_one(), PF SR-IOV
> state can be left allocated. Also, failures after bnx2x_vfpf_acquire()
> must release the PF resources before freeing the VF-PF mailbox allocated
> by bnx2x_vf_pci_alloc().
>
> Add error labels matching the resource acquisition order so probe failure
> disables MSI/MSI-X, removes SR-IOV state, releases VF-PF resources,
> deallocates VF PCI resources, and then frees the common driver memory.
> Also clear PCI drvdata before freeing the netdev on probe failure.
>
> Fixes: 6411280ac94d ("bnx2x: Segregate SR-IOV code")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
> Changes in v2:
> - Unwind all resources acquired by bnx2x_init_one() on failure
> - Clear PCI drvdata before freeing the netdev on probe failure.
> - Modify the commit title and message.
Reviewed-by: Simon Horman <horms@kernel.org>
FTR, there is an AI-generated review of this patch available on sashiko.dev.
However, I believe the issue flagged there can be looked at in the context
of possible follow-up and should not impede the progress of this patch.
prev parent reply other threads:[~2026-06-11 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 7:46 [PATCH v2] bnx2x: fix resource leaks in bnx2x_init_one() error paths Haoxiang Li
2026-06-11 15:32 ` Simon Horman [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=20260611153256.GU3920875@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ariele@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=skalluru@marvell.com \
--cc=stable@vger.kernel.org \
/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