]> Git Repo - qemu.git/commitdiff
iothread: Make iothread_stop() idempotent
authorEduardo Habkost <[email protected]>
Tue, 26 Sep 2017 13:00:28 +0000 (10:00 -0300)
committerPaolo Bonzini <[email protected]>
Fri, 29 Sep 2017 08:56:56 +0000 (10:56 +0200)
Currently, iothread_stop_all() makes all iothread objects unsafe
to be destroyed, because qemu_thread_join() ends up being called
twice.

To fix this, make iothread_stop() idempotent by checking
thread->stopped.

Fixes the following crash:

  qemu-system-x86_64 -object iothread,id=iothread0 -monitor stdio -display none
  QEMU 2.10.50 monitor - type 'help' for more information
  (qemu) quit
  qemu: qemu_thread_join: No such process
  Aborted (core dumped)

Reported-by: Christian Borntraeger <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170926130028[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
iothread.c

index 44c8944dc4ed023874d1f65fafd57df241a1216a..59d08509883fdb779222c654dd3cdd75efbca483 100644 (file)
@@ -85,7 +85,7 @@ static int iothread_stop(Object *object, void *opaque)
     IOThread *iothread;
 
     iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD);
-    if (!iothread || !iothread->ctx) {
+    if (!iothread || !iothread->ctx || iothread->stopping) {
         return 0;
     }
     iothread->stopping = true;
This page took 0.028361 seconds and 4 git commands to generate.