Patchwork [2/2] vnc: qemu can die if the client is disconnected while updating screen

login
register
mail settings
Submitter Corentin Chary
Date Jan. 25, 2011, 8:33 a.m.
Message ID <1295944407-19680-3-git-send-email-corentin.chary@gmail.com>
Download mbox | patch
Permalink /patch/80334/
State New
Headers show

Comments

Corentin Chary - Jan. 25, 2011, 8:33 a.m.
From: Corentin Chary <corentincj@iksaif.net>

agraf reported that qemu_mutex_destroy(vs->output_mutex) was failing
in vnc_disconnect_finish() when the vnc client was disconnected while
updating the screen.

It's because vnc_worker_thread_loop() tries to unlock the mutex while
not locked.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 ui/vnc-jobs-async.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/ui/vnc-jobs-async.c b/ui/vnc-jobs-async.c
index 6e9cf08..0b5d750 100644
--- a/ui/vnc-jobs-async.c
+++ b/ui/vnc-jobs-async.c
@@ -227,6 +227,10 @@  static int vnc_worker_thread_loop(VncJobQueue *queue)
 
         if (job->vs->csock == -1) {
             vnc_unlock_display(job->vs->vd);
+            /* output mutex must be locked before going to
+             * disconnected:
+             */
+            vnc_lock_output(job->vs);
             goto disconnected;
         }