diff mbox

drm: Restore lost drm_framebuffer_unreference in drm_mode_page_flip_ioctl

Message ID 20160928222500.11827-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Sept. 28, 2016, 10:25 p.m. UTC
Commit 43968d7b806d ("drm: Extract drm_plane.[hc]") was not the simple
cut'n'paste we presumed, somehow it introduced a leak of the page flip
target's framebuffer.

Fixes: 43968d7b806d ("drm: Extract drm_plane.[hc]")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/drm_plane.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel Vetter Sept. 29, 2016, 9 a.m. UTC | #1
On Wed, Sep 28, 2016 at 11:25:00PM +0100, Chris Wilson wrote:
> Commit 43968d7b806d ("drm: Extract drm_plane.[hc]") was not the simple
> cut'n'paste we presumed, somehow it introduced a leak of the page flip
> target's framebuffer.
> 
> Fixes: 43968d7b806d ("drm: Extract drm_plane.[hc]")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>

Oops, thanks for catching this, applied to drm-misc.
-Daniel

> ---
>  drivers/gpu/drm/drm_plane.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index cd0d475bf3c3..783aef8acab7 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -898,6 +898,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  out:
>  	if (ret && crtc->funcs->page_flip_target)
>  		drm_crtc_vblank_put(crtc);
> +	if (fb)
> +		drm_framebuffer_unreference(fb);
>  	if (crtc->primary->old_fb)
>  		drm_framebuffer_unreference(crtc->primary->old_fb);
>  	crtc->primary->old_fb = NULL;
> -- 
> 2.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index cd0d475bf3c3..783aef8acab7 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -898,6 +898,8 @@  int drm_mode_page_flip_ioctl(struct drm_device *dev,
 out:
 	if (ret && crtc->funcs->page_flip_target)
 		drm_crtc_vblank_put(crtc);
+	if (fb)
+		drm_framebuffer_unreference(fb);
 	if (crtc->primary->old_fb)
 		drm_framebuffer_unreference(crtc->primary->old_fb);
 	crtc->primary->old_fb = NULL;