From nobody Tue Feb 10 07:40:50 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507026867377127.09161902603569; Tue, 3 Oct 2017 03:34:27 -0700 (PDT) Received: from localhost ([::1]:57697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzKWn-0004Py-CX for importer@patchew.org; Tue, 03 Oct 2017 06:34:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzKUt-00032h-Q9 for qemu-devel@nongnu.org; Tue, 03 Oct 2017 06:32:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzKUt-0001ya-4U for qemu-devel@nongnu.org; Tue, 03 Oct 2017 06:32:19 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:44337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dzKUs-0001y5-UL for qemu-devel@nongnu.org; Tue, 03 Oct 2017 06:32:19 -0400 Received: by mail-wm0-x244.google.com with SMTP id 196so5527520wma.1 for ; Tue, 03 Oct 2017 03:32:18 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-246-117.clienti.tiscali.it. [78.12.246.117]) by smtp.gmail.com with ESMTPSA id x75sm16293812wme.3.2017.10.03.03.32.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 03:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=TnJo51oB4zBG9mVyEBzY7Vm0CnEsfZStHTmOpaEqd18=; b=RMC2+1pvoaqVt9ahwcoWckCL4mLti/IiQDxSRciTQzJOjZBvlsHGHaDDzRfnjPgLtA GOoirlmIngfWmkgLWmQNv9vHFrHH8060jyDEogkWEdwnHVaEDrN1Qv6HOFSayOxnOHr8 Z7RaXwx1GpI0vdYwC9TIl5ktvS1QQwZp7XljJ040/wULeh9jTP2AYmm4mw9YtZB46UYd HRCArlprQ2KEqNb+sGclWKfNSDrI6SfBffMT60uTGTaSI9/VESggoNvF9lQqQr6205A+ zJuc68aLsdo4wdg2YBoULlRfBwKtp6g9T2UQELDCuRsjAFL7TudIDHR4Iv9zb5Lw5oKw FxVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=TnJo51oB4zBG9mVyEBzY7Vm0CnEsfZStHTmOpaEqd18=; b=s+BdojjGwUlyQDBe7+tgpZRqJQqLEMtPS0/2daMHgWbDiU098OmCKjJPjrtNvCmXWe QEGMTYB3NGPQwNulDGfsk6W2pqTLuhI7JZRQXcVALNzSaiJxD/h0R1OCXa5Evs/5sReB XWgYmsuXbQfBnGNA+RvQTeG6Xtn2jJMurbFdRG2eK44Tkv7Xf6KlWknCrUeIHJjgU8YZ wy8o1VxiaaPrloteelSoX6mtAMYdVw3Hplih5kZ9T3wnHadDehzf7YSm/PoySYtZ9TNn T55zqa/LOgolLr0e57pmgGHUXnYruvUD1dYhfJ3Z+xq7EFC4cRiFT3U39ThgtJkwOgMe CHeg== X-Gm-Message-State: AMCzsaV1uD8NUlp4DX6S05rAm0Noo6FZxtlQtERlXFxGkzweJKYIdWzC DgfzdTxb7jiwK3K8TUBzHPhOxf2R X-Google-Smtp-Source: AOwi7QBmEi5ju378J7KIyChGMFGkyWH7w1mdQIcxpJVHMitVS3jeD9bAeZPwNfJkRfllKmyC87JsHQ== X-Received: by 10.28.236.203 with SMTP id h72mr5969706wmi.147.1507026737626; Tue, 03 Oct 2017 03:32:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 3 Oct 2017 12:28:37 +0200 Message-Id: <1507026521-19230-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1507026521-19230-1-git-send-email-pbonzini@redhat.com> References: <1507026521-19230-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 2/6] iothread: Make iothread_stop() idempotent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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=3Diothread0 -monitor stdio -displa= y 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 Signed-off-by: Eduardo Habkost Message-Id: <20170926130028.12471-1-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini --- iothread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iothread.c b/iothread.c index 44c8944..59d0850 100644 --- a/iothread.c +++ b/iothread.c @@ -85,7 +85,7 @@ static int iothread_stop(Object *object, void *opaque) IOThread *iothread; =20 iothread =3D (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD); - if (!iothread || !iothread->ctx) { + if (!iothread || !iothread->ctx || iothread->stopping) { return 0; } iothread->stopping =3D true; --=20 1.8.3.1