projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7922d3d
)
RDMA/mlx5: Fix memory leak in error flow for subscribe event routine
author
Yongzhi Liu
<lyz_cs@pku.edu.cn>
Fri, 11 Mar 2022 17:06:01 +0000
(09:06 -0800)
committer
Jason Gunthorpe
<jgg@nvidia.com>
Mon, 14 Mar 2022 23:41:10 +0000
(20:41 -0300)
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:
759738537142
("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>
drivers/infiniband/hw/mlx5/devx.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/infiniband/hw/mlx5/devx.c
b/drivers/infiniband/hw/mlx5/devx.c
index 08b7f6bc56c37a628aae752f889bfae24ae6fe56..15c0884d1f498ef524f251c86b552765f5e514ee 100644
(file)
--- a/
drivers/infiniband/hw/mlx5/devx.c
+++ b/
drivers/infiniband/hw/mlx5/devx.c
@@
-1886,8
+1886,10
@@
subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table,
key_level2,
obj_event,
GFP_KERNEL);
- if (err)
+ if (err) {
+ kfree(obj_event);
return err;
+ }
INIT_LIST_HEAD(&obj_event->obj_sub_list);
}