common/mlx5: fix shared memory region ranges allocation
authorBing Zhao <bingz@nvidia.com>
Tue, 23 Nov 2021 12:48:35 +0000 (14:48 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Tue, 23 Nov 2021 20:36:11 +0000 (21:36 +0100)
commit8947eebc999ef9328ea8175523076687ee9748e3
tree07753b3defad2c15c28a8c369890a50e6699691f
parent8fbce96fbed60ac6fada000b30d5671e2136eeb5
common/mlx5: fix shared memory region ranges allocation

Memory regions (MRs) were allocated in one chunk of memory with a
mempool registration object. However, MRs can be reused among
different mempool registrations.

When the registration that allocated the MRs originally was
destroyed, the dangling pointers to the MRs could be left in other
registrations sharing these MRs.

Splitting the memory allocation of registration structure and MRs in
this commit solves this pointer reference issue.

Fixes: 690b2a88c2f7 ("common/mlx5: add mempool registration facilities")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Reviewed-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
drivers/common/mlx5/mlx5_common_mr.c