Re: [PATCH v2 net] bnx2x: fix null pointer dereference in bnx2x_free_mem_bp()

From: Simon Horman

Date: Mon Jul 13 2026 - 11:29:47 EST


On Tue, Jul 07, 2026 at 11:16:16AM +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 initializing the
> fp_array_size after the bp->fp pointer is correctly initialized.
>
> Fixes: c3146eb676e7 ("bnx2x: Correct memory preparation and release")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Sashiko AI Review <sashiko-bot@xxxxxxxxxx>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
> Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
> ---
> Compile tested only.
> Thanks to Simon Horman for pointing out the Sashiko review.
>
> v1->v2:
> - Add the correct Reported-by tag for Sashiko as suggested by Maciej
> Fijalkowski. Also added Maciej's Reviewed-by tag.
> - Simplify the fix by initializing the fp_array_size later, as suggested
> by Paolo Abeni.
>
> Link to v1: https://patchwork.kernel.org/project/netdevbpf/patch/20260701065030.381836-1-nihaal@xxxxxxxxxxxxxx/

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>