* [PATCH] amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create
@ 2021-04-21 9:16 Simon Ser
2021-04-21 10:28 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Simon Ser @ 2021-04-21 9:16 UTC (permalink / raw)
To: amd-gfx
Cc: Alex Deucher, Harry Wentland, Nicholas Kazlauskas, Bas Nieuwenhuizen
This error code-path is missing a drm_gem_object_put call. Other
error code-paths are fine.
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 1769152ac64b ("drm/amdgpu: Fail fb creation from imported dma-bufs. (v2)")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 48cb33e5b382..1953223ecdba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -944,6 +944,7 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
domains = amdgpu_display_supported_domains(drm_to_adev(dev), bo->flags);
if (obj->import_attach && !(domains & AMDGPU_GEM_DOMAIN_GTT)) {
drm_dbg_kms(dev, "Cannot create framebuffer from imported dma_buf\n");
+ drm_gem_object_put(obj);
return ERR_PTR(-EINVAL);
}
--
2.31.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create
2021-04-21 9:16 [PATCH] amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create Simon Ser
@ 2021-04-21 10:28 ` Christian König
2021-04-28 21:14 ` Alex Deucher
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2021-04-21 10:28 UTC (permalink / raw)
To: Simon Ser, amd-gfx
Cc: Alex Deucher, Harry Wentland, Nicholas Kazlauskas, Bas Nieuwenhuizen
Am 21.04.21 um 11:16 schrieb Simon Ser:
> This error code-path is missing a drm_gem_object_put call. Other
> error code-paths are fine.
Good catch. For some extra points you could change the error handling
into using goto error instead of hand wiring it.
Either way patch is Reviewed-by: Christian König <christian.koenig@amd.com>
Thanks,
Christian.
>
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Fixes: 1769152ac64b ("drm/amdgpu: Fail fb creation from imported dma-bufs. (v2)")
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Harry Wentland <hwentlan@amd.com>
> Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 48cb33e5b382..1953223ecdba 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -944,6 +944,7 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
> domains = amdgpu_display_supported_domains(drm_to_adev(dev), bo->flags);
> if (obj->import_attach && !(domains & AMDGPU_GEM_DOMAIN_GTT)) {
> drm_dbg_kms(dev, "Cannot create framebuffer from imported dma_buf\n");
> + drm_gem_object_put(obj);
> return ERR_PTR(-EINVAL);
> }
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create
2021-04-21 10:28 ` Christian König
@ 2021-04-28 21:14 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-04-28 21:14 UTC (permalink / raw)
To: Christian König
Cc: Simon Ser, amd-gfx list, Bas Nieuwenhuizen, Alex Deucher,
Harry Wentland, Nicholas Kazlauskas
Applied. Thanks!
Alex
On Wed, Apr 21, 2021 at 6:29 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 21.04.21 um 11:16 schrieb Simon Ser:
> > This error code-path is missing a drm_gem_object_put call. Other
> > error code-paths are fine.
>
> Good catch. For some extra points you could change the error handling
> into using goto error instead of hand wiring it.
>
> Either way patch is Reviewed-by: Christian König <christian.koenig@amd.com>
>
> Thanks,
> Christian.
>
> >
> > Signed-off-by: Simon Ser <contact@emersion.fr>
> > Fixes: 1769152ac64b ("drm/amdgpu: Fail fb creation from imported dma-bufs. (v2)")
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: Harry Wentland <hwentlan@amd.com>
> > Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
> > Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > index 48cb33e5b382..1953223ecdba 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > @@ -944,6 +944,7 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
> > domains = amdgpu_display_supported_domains(drm_to_adev(dev), bo->flags);
> > if (obj->import_attach && !(domains & AMDGPU_GEM_DOMAIN_GTT)) {
> > drm_dbg_kms(dev, "Cannot create framebuffer from imported dma_buf\n");
> > + drm_gem_object_put(obj);
> > return ERR_PTR(-EINVAL);
> > }
> >
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-28 21:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 9:16 [PATCH] amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create Simon Ser
2021-04-21 10:28 ` Christian König
2021-04-28 21:14 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).