drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add
Subsystems (3)
PATCH 1/1 drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add
In vmw_cmdbuf_res_add if drm_ht_insert_item fails the allocated memory for cres should be released.
--- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +3 -1
@@ -209,8 +209,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);
Signature · 1 line
2.17.1
Quoted 5 lines · Navid Emamdoost
In
vmw_cmdbuf_res_addifdrm_ht_insert_itemfails the allocated memory for cres should be released.Signed-off-by Navid Emamdoost <[email protected]>
Would you please review this patch?
Thanks,
Quoted 23 lines
--- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +3
-2@@ -209,8 +209,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); --2.17.1
Signature · 1 line
Navid.
ping ...
Quoted 40 lines · Navid Emamdoost
Quoted 5 lines · Navid Emamdoost
In
vmw_cmdbuf_res_addifdrm_ht_insert_itemfails the allocated memory for cres should be released.Signed-off-by Navid Emamdoost <[email protected]>Would you please review this patch?
Thanks,
Quoted 21 lines
--- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +3
-2@@ -209,8 +209,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); --Quoted 2 lines
2.17.1
--
Navid.
Signature · 1 line
Navid.
Quoted 14 lines · Navid Emamdoost
In
vmw_cmdbuf_res_addifdrm_ht_insert_itemfails the allocated memory for cres should be released.Signed-off-by Navid Emamdoost <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +0
-0@@ -209,8 +209,10 @@ int vmw_cmdbuf_res_add(struct vmw_cmdbuf_res_manager *man,
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c int vmw_cmdbuf_res_add(struct vmw_cmdbuf_res_manager *man, · line 218
Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +3
-1cres->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);
Will be part of next vmwgfx-next pull.
Thanks,
Thomas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel