xf86-video-intel: src/sna/sna_driver.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Aug 25 15:37:42 PDT 2013


 src/sna/sna_driver.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

New commits:
commit e98cc0b1ce69a7ebc6b6ef4b916d05b9f73efe0b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Aug 25 23:05:32 2013 +0100

    sna: Make sure we assert our Master status before copying the fbcon
    
    Being able to read back the fbcon handle as a non-Master process is an
    information leak that will be fixed. We should already be Master by
    this point by virtue of the sequence in which we obtain the device fd.
    However, to be pedagogically correct, call drmSetMaster() before the
    fbcon copy.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 0787d8f..2a4a830 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -192,15 +192,12 @@ sna_set_fallback_mode(ScrnInfoPtr scrn)
 #endif
 }
 
-static Bool sna_become_master(struct sna *sna)
+static Bool sna_set_desired_mode(struct sna *sna)
 {
 	ScrnInfoPtr scrn = sna->scrn;
 
 	DBG(("%s\n", __FUNCTION__));
 
-	if (intel_get_master(scrn))
-		return FALSE;
-
 	if (!xf86SetDesiredModes(scrn)) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 			   "failed to restore desired modes on VT switch\n");
@@ -269,13 +266,21 @@ static Bool sna_create_screen_resources(ScreenPtr screen)
 	assert(sna->front == new_front);
 	screen->DestroyPixmap(new_front); /* transfer ownership to screen */
 
+	if (intel_get_master(sna->scrn)) {
+		xf86DrvMsg(screen->myNum, X_ERROR,
+			   "[intel] Failed to become DRM master\n");
+		screen->DestroyPixmap(sna->front);
+		sna->front = NULL;
+		return FALSE;
+	}
+
 	/* Only preserve the fbcon, not any subsequent server regens */
 	if (serverGeneration == 1 && (sna->flags & SNA_IS_HOSTED) == 0)
 		sna_copy_fbcon(sna);
 
-	if (!sna_become_master(sna)) {
+	if (!sna_set_desired_mode(sna)) {
 		xf86DrvMsg(screen->myNum, X_ERROR,
-			   "[intel] Failed to become DRM master\n");
+			   "[intel] Failed to set initial mode\n");
 		screen->DestroyPixmap(sna->front);
 		sna->front = NULL;
 		return FALSE;
@@ -1007,7 +1012,10 @@ static Bool sna_enter_vt(VT_FUNC_ARGS_DECL)
 	struct sna *sna = to_sna(scrn);
 
 	DBG(("%s\n", __FUNCTION__));
-	if (!sna_become_master(sna))
+	if (intel_get_master(scrn))
+		return FALSE;
+
+	if (!sna_set_desired_mode(sna))
 		return FALSE;
 
 	if (sna->flags & SNA_REPROBE) {


More information about the xorg-commit mailing list