qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vnc: qemu can die if the client is disconnected while updating screen
@ 2010-11-26 15:22 Corentin Chary
  2010-11-26 15:29 ` malc
  0 siblings, 1 reply; 2+ messages in thread
From: Corentin Chary @ 2010-11-26 15:22 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Corentin Chary, QEMU-devel Developers

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. The unlocking call doesn't fail (pthread bug ?), but
the destroy call does.

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

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;
         }
 
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] vnc: qemu can die if the client is disconnected while updating screen
  2010-11-26 15:22 [Qemu-devel] [PATCH] vnc: qemu can die if the client is disconnected while updating screen Corentin Chary
@ 2010-11-26 15:29 ` malc
  0 siblings, 0 replies; 2+ messages in thread
From: malc @ 2010-11-26 15:29 UTC (permalink / raw)
  To: Corentin Chary; +Cc: QEMU-devel Developers

On Fri, 26 Nov 2010, Corentin Chary wrote:

> 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. The unlocking call doesn't fail (pthread bug ?), but
> the destroy call does.
> 

Not bug but rather (expected in the absence of PTHREAD_MUTEX_ERRORCHECK)
undefined behaviour [1]

[1] http://www.opengroup.org/onlinepubs/7990989775/xsh/pthread_mutex_unlock.html

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-26 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-26 15:22 [Qemu-devel] [PATCH] vnc: qemu can die if the client is disconnected while updating screen Corentin Chary
2010-11-26 15:29 ` malc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).