From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Cc: <skalluru@marvell.com>, <manishc@marvell.com>,
<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<horms@kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH net] bnx2x: fix null pointer dereference in bnx2x_free_mem_bp()
Date: Wed, 1 Jul 2026 16:20:58 +0200 [thread overview]
Message-ID: <akUiSulQJ76q3CWj@boxer> (raw)
In-Reply-To: <20260701065030.381836-1-nihaal@cse.iitm.ac.in>
On Wed, Jul 01, 2026 at 12:20:26PM +0530, Abdun Nihaal wrote:
> In one of the error path in bnx2x_alloc_mem_bp(), bnx2x_free_mem_bp()
> may be called with bp->fp uninitialized. And so, there could be a null
> pointer dereference in bnx2x_free_mem_bp(). Fix that by adding a null
> check before the only dereference of bp->fp in the function.
>
> The issue was reported by Sashiko AI review.
>
> Fixes: c3146eb676e7 ("bnx2x: Correct memory preparation and release")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
> ---
> Compile tested only.
> Thanks to Simon Horman for pointing out the Sashiko review.
Should we include Reported-by tag given to Sashiko? I did that in my last
changes, I guess it would be good to track the amount of things fixed that
originated from Sashiko review.
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> index 5b2640bd31c3..25ee45cb7f3f 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> @@ -4712,8 +4712,9 @@ void bnx2x_free_mem_bp(struct bnx2x *bp)
> {
> int i;
>
> - for (i = 0; i < bp->fp_array_size; i++)
> - kfree(bp->fp[i].tpa_info);
> + if (bp->fp)
> + for (i = 0; i < bp->fp_array_size; i++)
> + kfree(bp->fp[i].tpa_info);
> kfree(bp->fp);
> kfree(bp->sp_objs);
> kfree(bp->fp_stats);
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2026-07-01 14:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 6:50 [PATCH net] bnx2x: fix null pointer dereference in bnx2x_free_mem_bp() Abdun Nihaal
2026-07-01 14:20 ` Maciej Fijalkowski [this message]
2026-07-03 14:12 ` Paolo Abeni
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=akUiSulQJ76q3CWj@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=nihaal@cse.iitm.ac.in \
--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