Skip to contentSkip to conversation

Fix flip event data leak if calloc or drmModeAddFB fails

PATCH In review Michel Dänzer 2 participants 3 messages Feb 7, 2017 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Fix flip event data leak if calloc or drmModeAddFB fails

From: Michel Dänzer <[email protected]>

---
 src/drmmode_display.c | 4 +++-
 src/radeon_dri2.c     | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)
src/drmmode_display.c +3 -1
index 314d63989..b64be462d 100644
@@ -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));
src/radeon_dri2.c +2 -2
index 860ff2904..d0dcf8906 100644
@@ -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);
 }
 
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170207094737.13109-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 2/2 Don't destroy current FB if drmModeAddFB fails

From: Michel Dänzer <[email protected]>

It would probably result in a black screen.

---
 src/drmmode_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/drmmode_display.c +2 -1
index b64be462d..c39b32558 100644
@@ -2949,7 +2949,8 @@ flip_error:
 		   strerror(errno));
 
 error:
-	if (flipdata && flipdata->flip_count <= 1) {
+	if (flipdata && flipdata->flip_count <= 1 &&
+	    drmmode->fb_id != flipdata->old_fb_id) {
 		drmModeRmFB(drmmode->fd, drmmode->fb_id);
 		drmmode->fb_id = flipdata->old_fb_id;
 	}
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170207094737.13109-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by Alex Deucher
#4 lore raw

RE: [PATCH xf86-video-ati 2/2] Don't destroy current FB if drmModeAddFB fails

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Tuesday, February 07, 2017 4:48 AM
To: [email protected]
Subject: [PATCH xf86-video-ati 2/2] Don't destroy current FB if drmModeAddFB fails

Quoted 5 lines

From: Michel Dänzer <[email protected]>

It would probably result in a black screen.

Series is:

Quoted 21 lines
---
 src/drmmode_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/drmmode_display.c +2 -2
index b64be462d..c39b32558 100644
@@ -2949,7 +2949,8 @@ flip_error:
 		   strerror(errno));
 
 error:
-	if (flipdata && flipdata->flip_count <= 1) {
+	if (flipdata && flipdata->flip_count <= 1 &&
+	    drmmode->fb_id != flipdata->old_fb_id) {
 		drmModeRmFB(drmmode->fd, drmmode->fb_id);
 		drmmode->fb_id = flipdata->old_fb_id;
 	}
--

2.11.0

Quoted 4 lines

_______________________________________________
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