[PATCH] drm/amdgpu: Fix memory leak
Alex Deucher
alexdeucher at gmail.com
Wed Mar 17 13:44:45 UTC 2021
On Wed, Mar 17, 2021 at 5:56 AM xinhui pan <xinhui.pan at amd.com> wrote:
>
> drm_gem_object_put() should be paired with drm_gem_object_lookup().
>
> All gem objs are saved in fb->base.obj[]. Need put the old first before
> assign a new obj.
>
> Trigger VRAM leak by running command below
> $ service gdm restart
>
> Signed-off-by: xinhui pan <xinhui.pan at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index bebed0f307a1..46dafea8da8b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -955,8 +955,9 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
> }
>
> for (i = 1; i < rfb->base.format->num_planes; ++i) {
> + drm_gem_object_get(rfb->base.obj[0]);
> + drm_gem_object_put(rfb->base.obj[i]);
> rfb->base.obj[i] = rfb->base.obj[0];
> - drm_gem_object_get(rfb->base.obj[i]);
> }
>
> return 0;
> @@ -1002,6 +1003,7 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
> return ERR_PTR(ret);
> }
>
> + drm_gem_object_put(obj);
> return &amdgpu_fb->base;
> }
>
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list