Skip to content

Commit df6134b

Browse files
zhipingz-51Paolo Abeni
authored andcommitted
net/mlx5: free mlx5_st_idx_data on final dealloc
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: 888a777 ("net/mlx5: Add support for device steering tag") Reviewed-by: Michael Gur <michaelgur@nvidia.com> Signed-off-by: Zhiping Zhang <zhipingz@meta.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20260702222507.1234467-1-zhipingz@meta.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 892d308 commit df6134b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core/lib

drivers/net/ethernet/mellanox/mlx5/core/lib/st.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ int mlx5_st_dealloc_index(struct mlx5_core_dev *dev, u16 st_index)
175175

176176
if (refcount_dec_and_test(&idx_data->usecount)) {
177177
xa_erase(&st->idx_xa, st_index);
178+
kfree(idx_data);
178179
/* We leave PCI config space as was before, no mkey will refer to it */
179180
}
180181

0 commit comments

Comments
 (0)