vmware/vmwgfx: Fix an error path segfault

Part of freedesktop.org bugzilla bug #80645
If taking a scanout reference on a pixmap fails, the
struct vmwgfx_screen_entry::pixmap pointer must be set to NULL, otherwise
the driver will incorrectly attempt to remove the scanout reference in the
error path, causing a segfault.

This problem is seen in the above-mentioned bug, but it is not the root
cause of the problem. With this patch applied, the server will terminate
cleanly instead of segfaulting.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
Thomas Hellstrom
2014-07-02 14:21:45 +02:00
parent 4e378a730d
commit 0a596fd0c9

View File

@@ -193,6 +193,7 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
crtcp->entry.pixmap = pixmap;
crtcp->scanout_id = vmwgfx_scanout_ref(&crtcp->entry);
if (crtcp->scanout_id == -1) {
crtcp->entry.pixmap = NULL;
LogMessage(X_ERROR, "Failed to convert pixmap to scanout.\n");
return FALSE;
}