]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Avoid loading resolutionSet when support for resolutionKMS available
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)
Loading resolutionSet with display NULL will cause a segmentation
fault in vmtoolsd user process. This change only avoids the
SEG fault. Still need to channel the resolution/topology request
to correct channel presenting the capabilities.

open-vm-tools/services/plugins/resolutionSet/resolutionX11.c

index d2a2a7a4066e4afc7a4be9f3ab6174161344b5de..cdb9988e5ca64524f45697ed752eec3fc725f968 100644 (file)
@@ -105,17 +105,28 @@ ResolutionBackendInit(InitHandle handle)
    if (resInfoX->canUseResolutionKMS == TRUE) {
       resInfo->canSetResolution = FALSE;
       resInfo->canSetTopology = FALSE;
-      return TRUE;
+      return FALSE;
    }
 
    XSetErrorHandler(ResolutionX11ErrorHandler);
    resInfoX->display = XOpenDisplay(NULL);
 
+   /*
+    * In case display is NULL, we do not load resolutionSet
+    * as it serve no purpose. Also avoids SEGFAULT issue
+    * like BZ1880932.
+    *
+    * VMX currently remembers the settings across a reboot,
+    * so let's say someone replaces our Xorg driver with
+    * xf86-video-modesetting, and then rebooted, we'd end up here,
+    * but the VMX would still send resolution / topology events
+    * and we'd hit the same segfault.
+    */
    if (resInfoX->display == NULL) {
       g_error("%s: Invalid display detected.\n", __func__);
       resInfo->canSetResolution = FALSE;
       resInfo->canSetTopology = FALSE;
-      return TRUE;
+      return FALSE;
    }
 
    resInfoX->rootWindow = DefaultRootWindow(resInfoX->display);