mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add
[ Upstream commit40efb09a7f
] In vmw_cmdbuf_res_add if drm_ht_insert_item fails the allocated memory for cres should be released. Fixes:18e4a4669c
("drm/vmwgfx: Fix compat shader namespace") Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c628e435c7
commit
97e780b7db
1 changed files with 3 additions and 1 deletions
|
@ -210,8 +210,10 @@ int vmw_cmdbuf_res_add(struct vmw_cmdbuf_res_manager *man,
|
|||
|
||||
cres->hash.key = user_key | (res_type << 24);
|
||||
ret = drm_ht_insert_item(&man->resources, &cres->hash);
|
||||
if (unlikely(ret != 0))
|
||||
if (unlikely(ret != 0)) {
|
||||
kfree(cres);
|
||||
goto out_invalid_key;
|
||||
}
|
||||
|
||||
cres->state = VMW_CMDBUF_RES_ADD;
|
||||
cres->res = vmw_resource_reference(res);
|
||||
|
|
Loading…
Reference in a new issue