Re: [PATCH net] bnx2x: Fix potential IRO array leak on removal
From: Daniel Machon
Date: Tue Nov 17 2026 - 06:55:59 EST
> Firmware initialization allocates a separate IRO array, but
> bnx2x_release_firmware() only frees the other parsed tables. Removing
> the device loses the array pointer with the netdev.
>
> Free the IRO array with the remaining firmware tables.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: 523224a3b3cd ("bnx2x, cnic, bnx2i: use new FW/HSI")
> Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
> ---
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> index 277c7bd9c6e7..c6afde9466be 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -13489,6 +13489,7 @@ static int bnx2x_init_firmware(struct bnx2x *bp)
>
> static void bnx2x_release_firmware(struct bnx2x *bp)
> {
> + kfree(bp->iro_arr);
> kfree(bp->init_ops_offsets);
> kfree(bp->init_ops);
> kfree(bp->init_data);
>
> base-commit: 2e54b3e187300893688c2c7517894f5d96732e05
Looks right, however bnx2x_release_firmware() is only ever called from the
remove path. So seems like net-next material.
For the fix:
Reviewed-by: Daniel Machon <daniel.machon@xxxxxxxxxxxxx>