mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
RDMA/mlx5: Fix memory leak in error flow for subscribe event routine
[ Upstream commit087f9c3f23] In case the second xa_insert() fails, the obj_event is not released. Fix the error unwind flow to free that memory to avoid a memory leak. Fixes:7597385371("IB/mlx5: Enable subscription for device events over DEVX") Link: https://lore.kernel.org/r/1647018361-18266-1-git-send-email-lyz_cs@pku.edu.cn Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a3587259ae
commit
c98d903ff9
@@ -1792,8 +1792,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table,
|
|||||||
key_level2,
|
key_level2,
|
||||||
obj_event,
|
obj_event,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (err)
|
if (err) {
|
||||||
|
kfree(obj_event);
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
INIT_LIST_HEAD(&obj_event->obj_sub_list);
|
INIT_LIST_HEAD(&obj_event->obj_sub_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user