7084842
From 717cfd417b7b4be50d73c684b028a20ddcbb568e Mon Sep 17 00:00:00 2001
7084842
From: Keith Packard <keithp@keithp.com>
7084842
Date: Wed, 2 Nov 2016 13:39:50 -0700
7084842
Subject: [PATCH xserver v2 3/7] dix: Make sure client is not in output_pending
7084842
 chain after closed (RH 1382444)
7084842
7084842
I think it is possible that output could get queued to a client during
7084842
CloseDownClient. After it is removed from the pending queue, active
7084842
grabs are released, the client is awoken if sleeping and any work
7084842
queue entries related to the client are processed.
7084842
7084842
To fix this, move the call removing it from the output_pending chain
7084842
until after clientGone has been set and then check clientGone in
7084842
output_pending_mark.
7084842
7084842
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1382444
7084842
Signed-off-by: Keith Packard <keithp@keithp.com>
7084842
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7084842
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7084842
---
7084842
 dix/dispatch.c      | 2 +-
7084842
 include/dixstruct.h | 2 +-
7084842
 2 files changed, 2 insertions(+), 2 deletions(-)
7084842
7084842
diff --git a/dix/dispatch.c b/dix/dispatch.c
7084842
index e111377..3d0fe26 100644
7084842
--- a/dix/dispatch.c
7084842
+++ b/dix/dispatch.c
7084842
@@ -3406,7 +3406,6 @@ CloseDownClient(ClientPtr client)
7084842
             UngrabServer(client);
7084842
         }
7084842
         mark_client_not_ready(client);
7084842
-        xorg_list_del(&client->output_pending);
7084842
         BITCLEAR(grabWaiters, client->index);
7084842
         DeleteClientFromAnySelections(client);
7084842
         ReleaseActiveGrabs(client);
7084842
@@ -3435,6 +3434,7 @@ CloseDownClient(ClientPtr client)
7084842
         if (ClientIsAsleep(client))
7084842
             ClientSignal(client);
7084842
         ProcessWorkQueueZombies();
7084842
+        output_pending_clear(client);
7084842
         CloseDownConnection(client);
7084842
 
7084842
         /* If the client made it to the Running stage, nClients has
7084842
diff --git a/include/dixstruct.h b/include/dixstruct.h
7084842
index 3b578f8..d71b0ac 100644
7084842
--- a/include/dixstruct.h
7084842
+++ b/include/dixstruct.h
7084842
@@ -159,7 +159,7 @@ extern struct xorg_list output_pending_clients;
7084842
 static inline void
7084842
 output_pending_mark(ClientPtr client)
7084842
 {
7084842
-    if (xorg_list_is_empty(&client->output_pending))
7084842
+    if (!client->clientGone && xorg_list_is_empty(&client->output_pending))
7084842
         xorg_list_append(&client->output_pending, &output_pending_clients);
7084842
 }
7084842
 
7084842
-- 
7084842
2.9.3
7084842