drm/amd/amdgpu: fix refcount leak
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: fix refcount leak
[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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -0
@@ -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);
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 17.05.21 um 10:26 schrieb Jingwen Chen:
Quoted 8 lines
[Why]
the gem object rfb->base.obj[0] is get according tonum_planesinamdgpufb_create, but is not put according tonum_planes[How]
put rfb->base.obj[0] inamdgpu_fbdev_destroyaccording tonum_planesSigned-off-by Jingwen Chen <[email protected]>
Looks sane to me, but Alex might want to take a look as well.
Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0
-0@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 300
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3
-0+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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Reviewed-byQuoted 6 lines · Christian König
Am 17.05.21 um 10:26 schrieb Jingwen Chen:
Quoted 4 lines
[Why]
the gem object rfb->base.obj[0] is get according tonum_planesinamdgpufb_create, but is not put according tonum_planes
Quoted 8 lines
Quoted 4 lines
[How]
put rfb->base.obj[0] inamdgpu_fbdev_destroyaccording tonum_planesSigned-off-by Jingwen Chen <[email protected]>Looks sane to me, but Alex might want to take a look as well.
Acked-by Christian König <[email protected]>
Looks good to me as well.
Quoted 17 lines
Quoted 17 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1
-0@@ -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);
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 300
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2
-0if (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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx