]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/amdgpu: fix refcount leak
authorJingwen Chen <Jingwen.Chen2@amd.com>
Mon, 17 May 2021 08:16:10 +0000 (16:16 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 20 May 2021 02:43:43 +0000 (22:43 -0400)
[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>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c

index 4f10c452984068c08428f440ca9cc8675e23c798..09b0486475232ffbeec31d3fd70ff1332c6c168e 100644 (file)
@@ -288,10 +288,13 @@ out:
 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);