[PATCH] net/mlx5: fix segfault in counter pool destroy
Thomas Monjalon
thomas at monjalon.net
Thu Jun 26 14:17:08 CEST 2025
25/06/2025 11:32, Maayan Kashani:
> When there is not enough memory, counter pool creation fails.
> As a result, the pool is being destroyed.
> Since not all pointers were initialized during creation,
> Need to check for null pointer in destruction.
>
> Fixes: 13ea6bdcc7ee ("net/mlx5: support counters in cross port shared mode")
> Cc: stable at dpdk.org
>
> Signed-off-by: Maayan Kashani <mkashani at nvidia.com>
> Acked-by: Bing Zhao <bingz at nvidia.com>
> ---
> --- a/drivers/net/mlx5/mlx5_hws_cnt.c
> +++ b/drivers/net/mlx5/mlx5_hws_cnt.c
> @@ -810,7 +810,7 @@ mlx5_hws_cnt_pool_destroy(struct mlx5_dev_ctx_shared *sh,
> LIST_REMOVE(cpool, next);
> rte_spinlock_unlock(&sh->cpool_lock);
> if (cpool->cfg.host_cpool == NULL) {
> - if (--sh->cnt_svc->refcnt == 0)
> + if (sh->cnt_svc && --sh->cnt_svc->refcnt == 0)
> mlx5_hws_cnt_svc_deinit(sh);
Applied, thanks.
More information about the dev
mailing list