All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define
@ 2019-09-25  4:46 ` Navid Emamdoost
  0 siblings, 0 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-09-25  4:46 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, VMware Graphics,
	Thomas Hellstrom, David Airlie, Daniel Vetter, dri-devel,
	linux-kernel

In vmw_context_define if vmw_context_init fails the allocated resource
should be unreferenced. The goto label was fixed.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index a56c9d802382..ac42f8a6acf0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -773,7 +773,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
 
 	ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx);
 	if (unlikely(ret != 0))
-		goto out_unlock;
+		goto out_err;
 
 	tmp = vmw_resource_reference(&ctx->res);
 	ret = ttm_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define
@ 2019-09-25  4:46 ` Navid Emamdoost
  0 siblings, 0 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-09-25  4:46 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, VMware Graphics,
	Thomas Hellstrom, David Airlie, Daniel Vetter, dri-devel,
	linux-kernel

In vmw_context_define if vmw_context_init fails the allocated resource
should be unreferenced. The goto label was fixed.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index a56c9d802382..ac42f8a6acf0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -773,7 +773,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
 
 	ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx);
 	if (unlikely(ret != 0))
-		goto out_unlock;
+		goto out_err;
 
 	tmp = vmw_resource_reference(&ctx->res);
 	ret = ttm_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define
  2019-09-25  4:46 ` Navid Emamdoost
@ 2019-12-11 10:20   ` Thomas Hellstrom
  -1 siblings, 0 replies; 4+ messages in thread
From: Thomas Hellstrom @ 2019-12-11 10:20 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, Linux-graphics-maintainer,
	David Airlie, Daniel Vetter, dri-devel, linux-kernel

On 9/25/19 6:46 AM, Navid Emamdoost wrote:
> In vmw_context_define if vmw_context_init fails the allocated resource
> should be unreferenced. The goto label was fixed.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> index a56c9d802382..ac42f8a6acf0 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> @@ -773,7 +773,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
>  
>  	ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx);
>  	if (unlikely(ret != 0))
> -		goto out_unlock;
> +		goto out_err;
>  
>  	tmp = vmw_resource_reference(&ctx->res);
>  	ret = ttm_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,

This patch doesn't look correct. vmw_context_init should free up all
resources if failing.

Thanks,

Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define
@ 2019-12-11 10:20   ` Thomas Hellstrom
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Hellstrom @ 2019-12-11 10:20 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: David Airlie, kjlu, linux-kernel, dri-devel, emamd001,
	Linux-graphics-maintainer, smccaman

On 9/25/19 6:46 AM, Navid Emamdoost wrote:
> In vmw_context_define if vmw_context_init fails the allocated resource
> should be unreferenced. The goto label was fixed.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> index a56c9d802382..ac42f8a6acf0 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> @@ -773,7 +773,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
>  
>  	ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx);
>  	if (unlikely(ret != 0))
> -		goto out_unlock;
> +		goto out_err;
>  
>  	tmp = vmw_resource_reference(&ctx->res);
>  	ret = ttm_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,

This patch doesn't look correct. vmw_context_init should free up all
resources if failing.

Thanks,

Thomas


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-11 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25  4:46 [PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define Navid Emamdoost
2019-09-25  4:46 ` Navid Emamdoost
2019-12-11 10:20 ` Thomas Hellstrom
2019-12-11 10:20   ` Thomas Hellstrom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.