Commit 9739b6a6 authored by Hans de Goede's avatar Hans de Goede

Fix crash caused by attempting to access the screen pixmap before it is created

qxl_resize_primary_to_virtual() was using pScrn->pScreen != NULL to check
if createScreenResources has been called. But starting with xserver 1.19
pScrn->pScreen is non NULL even before createScreenResources is called,
causing an invalid access to the screenPixmap in
qxl_resize_primary_to_virtual().

This commit fixes this.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1381045Signed-off-by: 's avatarHans de Goede <hdegoede@redhat.com>
Acked-by: Christophe Fergeau's avatarChristophe Fergeau <cfergeau@redhat.com>
parent e13d28ee
......@@ -234,6 +234,7 @@ struct _qxl_screen_t
struct qxl_ring * cursor_ring;
struct qxl_ring * release_ring;
Bool screen_resources_created;
int device_primary;
struct qxl_bo * primary_bo;
int num_modes;
......
......@@ -530,7 +530,6 @@ qxl_create_primary(qxl_screen_t *qxl)
Bool
qxl_resize_primary_to_virtual (qxl_screen_t *qxl)
{
ScreenPtr pScreen;
long new_surface0_size;
if ((qxl->primary_mode.x_res == qxl->virtual_x &&
......@@ -566,9 +565,9 @@ qxl_resize_primary_to_virtual (qxl_screen_t *qxl)
qxl->primary = qxl_create_primary(qxl);
qxl->bytes_per_pixel = (qxl->pScrn->bitsPerPixel + 7) / 8;
pScreen = qxl->pScrn->pScreen;
if (pScreen)
if (qxl->screen_resources_created)
{
ScreenPtr pScreen = qxl->pScrn->pScreen;
PixmapPtr root = pScreen->GetScreenPixmap (pScreen);
if (qxl->deferred_fps <= 0)
......@@ -645,6 +644,7 @@ qxl_create_screen_resources (ScreenPtr pScreen)
qxl_create_desired_modes (qxl);
qxl_update_edid (qxl);
qxl->screen_resources_created = TRUE;
return TRUE;
}
......
......@@ -235,6 +235,7 @@ qxl_create_screen_resources_kms(ScreenPtr pScreen)
if (!uxa_resources_init (pScreen))
return FALSE;
qxl->screen_resources_created = TRUE;
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment