From: Simon Horman <horms@kernel.org>
To: Jiangshan Yi <yijiangshan@kylinos.cn>
Cc: skalluru@marvell.com, manishc@marvell.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, vladz@broadcom.com, eilong@broadcom.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
13667453960@163.com, stable@vger.kernel.org
Subject: Re: [PATCH] bnx2x: fix double free in bnx2x_init_firmware() error path
Date: Tue, 18 Aug 2026 20:06:15 +0100 [thread overview]
Message-ID: <20260818190615.GJ265046@horms.kernel.org> (raw)
In-Reply-To: <20260815122149.951215-1-yijiangshan@kylinos.cn>
On Sat, Aug 15, 2026 at 08:21:49PM +0800, Jiangshan Yi wrote:
> bnx2x_init_firmware() frees bp->init_ops, bp->init_data and
> bp->init_ops_offsets in its error path without setting them to NULL.
> The cleanup function bnx2x_release_firmware() frees the same three
> pointers unconditionally, so if init_firmware fails and
> release_firmware is later called (e.g. from __bnx2x_remove or through
> the function state machine), all three are freed a second time.
>
> Set each pointer to NULL after kfree() in the error path so that the
> subsequent kfree(NULL) in bnx2x_release_firmware() is a safe no-op.
>
> Fixes: 94a78b79cb5f ("bnx2x: Separated FW from the source.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-08-18 19:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 12:21 [PATCH] bnx2x: fix double free in bnx2x_init_firmware() error path Jiangshan Yi
2026-08-18 19:06 ` Simon Horman [this message]
2026-08-20 19:50 ` patchwork-bot+netdevbpf
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=20260818190615.GJ265046@horms.kernel.org \
--to=horms@kernel.org \
--cc=13667453960@163.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eilong@broadcom.com \
--cc=kuba@kernel.org \
--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 \
--cc=vladz@broadcom.com \
--cc=yijiangshan@kylinos.cn \
/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