Re: [PATCH net] bnxt_en: Fix auxiliary device leak on early probe failures

From: Joe Damato

Date: Wed Nov 18 2026 - 12:25:14 EST


On Wed, Nov 18, 2026 at 12:07:16AM -0500, Changyul Lee wrote:
> bnxt_init_one() allocates the auxiliary device ID and initializes the
> auxiliary devices before bnxt_set_dflt_rings(). If that call,
> bnxt_init_int_mode() or the bnxt_pf_wq allocation fails, probe jumps to
> init_err_pci_clean, which does not uninitialize the devices or free the
> ID. Only init_err_cleanup does. The devices are never released, so their
> aux_priv, edev and ulp_tbl allocations and the ID in bnxt_aux_dev_ids are
> leaked once free_netdev() frees bp. A VF probed while the PF is down
> fails this way each time.
>
> Add an init_err_auxdev label for this cleanup and use it for every
> failure after the devices are initialized. On the register_netdev()
> failure path the cleanup now runs after bnxt_clear_int_mode(), in the
> reverse order of setup.
>
> Fixes: 2e4592dc9bee ("bnxt_en: Change MSIX/NQs allocation policy")
> Signed-off-by: Changyul Lee <lcy8047@xxxxxxxxx>
> ---
> Found with a static analysis tool we are developing.
>
> Compile-tested only, with x86_64_defconfig plus BNXT and W=1.
>
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Joe Damato <joe@xxxxxxx>