[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <MN2PR05MB6141CA532CFFE7A8C519797FA15A0@MN2PR05MB6141.namprd05.prod.outlook.com>
Date: Wed, 11 Dec 2019 10:19:55 +0000
From: Thomas Hellstrom <thellstrom@...are.com>
To: Navid Emamdoost <navid.emamdoost@...il.com>
CC: "emamd001@....edu" <emamd001@....edu>,
"kjlu@....edu" <kjlu@....edu>,
"smccaman@....edu" <smccaman@....edu>,
Linux-graphics-maintainer <Linux-graphics-maintainer@...are.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add
On 9/25/19 6:38 AM, Navid Emamdoost wrote:
> In vmw_cmdbuf_res_add if drm_ht_insert_item fails the allocated memory
> for cres should be released.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
> index 4ac55fc2bf97..44d858ce4ce7 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
> @@ -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);
Reviewed-by: Thomas Hellstrom <thellstrom@...are.com>
Will be part of next vmwgfx-next pull.
Thanks,
Thomas
Powered by blists - more mailing lists