]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
drm: writeback: Fix leak of writeback job
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 21 Feb 2019 00:51:37 +0000 (02:51 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
commit99334cffaa031f3e5c052f854fa07c5d09ec7c0a
treece6d411efc9728924a357906782f44e90cd5090a
parent3aec7666ab13dcc4abffac6f0b628090b5b0f3ef
drm: writeback: Fix leak of writeback job

BugLink: https://bugs.launchpad.net/bugs/1837517
[ Upstream commit e482ae9b5fdc01a343f22f52930e85a6cfdf85eb ]

Writeback jobs are allocated when the WRITEBACK_FB_ID is set, and
deleted when the jobs complete. This results in both a memory leak of
the job and a leak of the framebuffer if the atomic commit returns
before the job is queued for processing, for instance if the atomic
check fails or if the commit runs in test-only mode.

Fix this by implementing the drm_writeback_cleanup_job() function and
calling it from __drm_atomic_helper_connector_destroy_state(). As
writeback jobs are removed from the state when they're queued for
processing, any job left in the state when the state gets destroyed
needs to be cleaned up.

The existing declaration of the drm_writeback_cleanup_job() function
without an implementation hints that this problem was considered, but
never addressed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpu/drm/drm_atomic_state_helper.c
drivers/gpu/drm/drm_writeback.c