projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
834b1d7
)
drm/vmwgfx: fix a memleak in vmw_gmrid_man_get_node
author
Zhipeng Lu
<alexious@zju.edu.cn>
Mon, 4 Dec 2023 09:14:16 +0000
(17:14 +0800)
committer
Zack Rusin
<zack.rusin@broadcom.com>
Thu, 4 Jan 2024 03:23:15 +0000
(22:23 -0500)
When ida_alloc_max fails, resources allocated before should be freed,
including *res allocated by kmalloc and ttm_resource_init.
Fixes: d3bcb4b02fe9 ("drm/vmwgfx: switch the TTM backends to self alloc")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link:
https://patchwork.freedesktop.org/patch/msgid/20231204091416.3308430-1-alexious@zju.edu.cn
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index ceb4d3d3b965aacb7c0794b9dc7d9a6ad09b4098..a0b47c9b33f552a6d8022596c4acd6ec3420909d 100644
(file)
--- a/
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@
-64,8
+64,11
@@
static int vmw_gmrid_man_get_node(struct ttm_resource_manager *man,
ttm_resource_init(bo, place, *res);
id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
- if (id < 0)
+ if (id < 0) {
+ ttm_resource_fini(man, *res);
+ kfree(*res);
return id;
+ }
spin_lock(&gman->lock);