Re: [PATCH net v2] net/mlx5: free mlx5_st_idx_data on final dealloc
From: Leon Romanovsky <leon@kernel.org>
Date: 2026-07-05 14:19:27
Also in:
linux-rdma, lkml, stable
From: Leon Romanovsky <leon@kernel.org>
Date: 2026-07-05 14:19:27
Also in:
linux-rdma, lkml, stable
On Tue, Jun 30, 2026 at 09:53:20AM -0700, Zhiping Zhang wrote:
Workloads that repeatedly allocate and release mkeys carrying TPH
steering-tag hints (e.g. churning RDMA MRs) leak one
struct mlx5_st_idx_data per cycle; kmemleak flags it as unreferenced
and the kmalloc slab grows over time.
When the last reference to an ST table entry is dropped,
mlx5_st_dealloc_index() removed the entry from idx_xa but the backing
mlx5_st_idx_data allocation was never freed.
Free idx_data after the xa_erase() so the lifetime of the bookkeeping
struct matches the lifetime of the ST entry it tracks.
Cc: stable@vger.kernel.org
Fixes: 888a7776f4fb ("net/mlx5: Add support for device steering tag")
Reviewed-by: Michael Gur <redacted>
Signed-off-by: Zhiping Zhang <redacted>
---
v2: respin per maintainer-netdev.rst; no code change.
v1: https://lore.kernel.org/linux-rdma/20260612170406.3339093-1-zhipingz@meta.com/ (local)
drivers/net/ethernet/mellanox/mlx5/core/lib/st.c | 1 +
1 file changed, 1 insertion(+)Thanks, Reviewed-by: Leon Romanovsky <leonro@nvidia.com>