summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-06-23 09:29:13 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-07-04 17:45:16 +1000
commitce393de0efb8626d15f3b97c97916971a6aefebd (patch)
tree3ddc2938a577f81c33a8c93f081a08b75c1dd8ca
parent43527d31810fe94a5eb4b2543bbc8eb26b1654b7 (diff)
modesetting: handle NULL cursor in drmmode_set_cursor.
We had a bug reported with a touchscreen where we could end up in here with a NULL cursor, so let's not crash the X server. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-and-Tested-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 961b56127..b5a03256e 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -759,6 +759,9 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
CursorPtr cursor = xf86CurrentCursor(crtc->scrn->pScreen);
int ret = -EINVAL;
+ if (cursor == NullCursor)
+ return TRUE;
+
ret = drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
handle, ms->cursor_width, ms->cursor_height,
cursor->bits->xhot, cursor->bits->yhot);