All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: fix refcount leak
@ 2021-05-17  8:26 Jingwen Chen
  2021-05-17  8:47 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Jingwen Chen @ 2021-05-17  8:26 UTC (permalink / raw)
  To: amd-gfx; +Cc: Jingwen Chen, monk.liu

[Why]
the gem object rfb->base.obj[0] is get according to num_planes
in amdgpufb_create, but is not put according to num_planes

[How]
put rfb->base.obj[0] in amdgpu_fbdev_destroy according to num_planes

Signed-off-by: Jingwen Chen <Jingwen.Chen2@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 4f10c4529840..09b048647523 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -288,10 +288,13 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev)
 {
 	struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
+	int i;
 
 	drm_fb_helper_unregister_fbi(&rfbdev->helper);
 
 	if (rfb->base.obj[0]) {
+		for (i = 0; i < rfb->base.format->num_planes; i++)
+			drm_gem_object_put(rfb->base.obj[0]);
 		amdgpufb_destroy_pinned_object(rfb->base.obj[0]);
 		rfb->base.obj[0] = NULL;
 		drm_framebuffer_unregister_private(&rfb->base);
-- 
2.25.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] drm/amd/amdgpu: fix refcount leak
  2021-05-17  8:26 [PATCH] drm/amd/amdgpu: fix refcount leak Jingwen Chen
@ 2021-05-17  8:47 ` Christian König
  2021-05-17 17:20   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2021-05-17  8:47 UTC (permalink / raw)
  To: Jingwen Chen, amd-gfx; +Cc: monk.liu

Am 17.05.21 um 10:26 schrieb Jingwen Chen:
> [Why]
> the gem object rfb->base.obj[0] is get according to num_planes
> in amdgpufb_create, but is not put according to num_planes
>
> [How]
> put rfb->base.obj[0] in amdgpu_fbdev_destroy according to num_planes
>
> Signed-off-by: Jingwen Chen <Jingwen.Chen2@amd.com>

Looks sane to me, but Alex might want to take a look as well.

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> index 4f10c4529840..09b048647523 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> @@ -288,10 +288,13 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>   static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev)
>   {
>   	struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
> +	int i;
>   
>   	drm_fb_helper_unregister_fbi(&rfbdev->helper);
>   
>   	if (rfb->base.obj[0]) {
> +		for (i = 0; i < rfb->base.format->num_planes; i++)
> +			drm_gem_object_put(rfb->base.obj[0]);
>   		amdgpufb_destroy_pinned_object(rfb->base.obj[0]);
>   		rfb->base.obj[0] = NULL;
>   		drm_framebuffer_unregister_private(&rfb->base);

_______________________________________________
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] drm/amd/amdgpu: fix refcount leak
  2021-05-17  8:47 ` Christian König
@ 2021-05-17 17:20   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-05-17 17:20 UTC (permalink / raw)
  To: Christian König; +Cc: Jingwen Chen, monk.liu, amd-gfx list

On Mon, May 17, 2021 at 4:47 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 17.05.21 um 10:26 schrieb Jingwen Chen:
> > [Why]
> > the gem object rfb->base.obj[0] is get according to num_planes
> > in amdgpufb_create, but is not put according to num_planes
> >
> > [How]
> > put rfb->base.obj[0] in amdgpu_fbdev_destroy according to num_planes
> >
> > Signed-off-by: Jingwen Chen <Jingwen.Chen2@amd.com>
>
> Looks sane to me, but Alex might want to take a look as well.
>
> Acked-by: Christian König <christian.koenig@amd.com>

Looks good to me as well.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > index 4f10c4529840..09b048647523 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > @@ -288,10 +288,13 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
> >   static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev)
> >   {
> >       struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
> > +     int i;
> >
> >       drm_fb_helper_unregister_fbi(&rfbdev->helper);
> >
> >       if (rfb->base.obj[0]) {
> > +             for (i = 0; i < rfb->base.format->num_planes; i++)
> > +                     drm_gem_object_put(rfb->base.obj[0]);
> >               amdgpufb_destroy_pinned_object(rfb->base.obj[0]);
> >               rfb->base.obj[0] = NULL;
> >               drm_framebuffer_unregister_private(&rfb->base);
>
> _______________________________________________
> 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-05-17 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  8:26 [PATCH] drm/amd/amdgpu: fix refcount leak Jingwen Chen
2021-05-17  8:47 ` Christian König
2021-05-17 17:20   ` Alex Deucher

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.