[PATCH xf86-video-ati 1/2] Fix flip event data leak if calloc or drmModeAddFB fails

Michel Dänzer michel at daenzer.net
Tue Feb 7 09:47:36 UTC 2017


From: Michel Dänzer <michel.daenzer at amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 4 +++-
 src/radeon_dri2.c     | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 314d63989..b64be462d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2958,8 +2958,10 @@ error:
 		radeon_drm_abort_entry(drm_queue_seq);
 	else if (crtc)
 		drmmode_flip_abort(crtc, flipdata);
-	else if (flipdata && flipdata->flip_count <= 1)
+	else {
+		abort(NULL, data);
 		free(flipdata);
+	}
 
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Page flip failed: %s\n",
 		   strerror(errno));
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 860ff2904..d0dcf8906 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -579,9 +579,9 @@ xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
 static void
 radeon_dri2_flip_event_abort(xf86CrtcPtr crtc, void *event_data)
 {
-    RADEONInfoPtr info = RADEONPTR(crtc->scrn);
+    if (crtc)
+	RADEONPTR(crtc->scrn)->drmmode.dri2_flipping = FALSE;
 
-    info->drmmode.dri2_flipping = FALSE;
     free(event_data);
 }
 
-- 
2.11.0



More information about the amd-gfx mailing list