On 6/11/2026 7:11 PM, Zhiping Zhang wrote:
When the last reference to an ST table entry is dropped, mlx5_st_dealloc_index() removed the entry from idx_xa but leaked the backing mlx5_st_idx_data allocation. Repeated alloc/dealloc cycles therefore accumulate one struct mlx5_st_idx_data per cycle. Free idx_data after the xa_erase() so the lifetime of the bookkeeping struct matches the lifetime of the ST entry it tracks. Fixes: 888a7776f4fb ("net/mlx5: Add support for device steering tag") Signed-off-by: Zhiping Zhang <[email protected]> --- drivers/net/ethernet/mellanox/mlx5/core/lib/st.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c index 997be91f0a13..7cedc348790d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c @@ -175,6 +175,7 @@ int mlx5_st_dealloc_index(struct mlx5_core_dev *dev, u16 st_index)if (refcount_dec_and_test(&idx_data->usecount)) {xa_erase(&st->idx_xa, st_index); + kfree(idx_data); /* We leave PCI config space as was before, no mkey will refer to it */ }
Reviewed-by: Michael Gur <[email protected]> Thanks.
