From 64ca14b85e45b13628396f21d1903e311f92a9e1 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 2 Mar 2017 10:19:26 +0100 Subject: [PATCH] xwayland: make sure client is not gone in sync callback in XWayland, dri3_send_open_reply() is called from a sync callback, so there is a possibility that the client might be gone when we get to the callback eventually, which leads to a crash in _XSERVTransSendFd() from WriteFdToClient() . Check if clientGone has been set in the sync callback handler to avoid this. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99149 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100040 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1416553 Reviewed-by: Adam Jackson Signed-off-by: Olivier Fourdan Tested-by: Mark B --- hw/xwayland/xwayland-glamor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index b3d0aab68..65c3c0024 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -435,9 +435,12 @@ static void sync_callback(void *data, struct wl_callback *callback, uint32_t serial) { struct xwl_auth_state *state = data; + ClientPtr client = state->client; - dri3_send_open_reply(state->client, state->fd); - AttendClient(state->client); + if (!client->clientGone) { + dri3_send_open_reply(client, state->fd); + AttendClient(client); + } free(state); wl_callback_destroy(callback); }