From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUqM0-00075k-35 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 05:21:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUqLz-0000YT-6q for qemu-devel@nongnu.org; Mon, 18 Jun 2018 05:21:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55846 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fUqLz-0000XQ-1j for qemu-devel@nongnu.org; Mon, 18 Jun 2018 05:21:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92F9283207 for ; Mon, 18 Jun 2018 09:21:38 +0000 (UTC) From: Gerd Hoffmann Date: Mon, 18 Jun 2018 11:21:32 +0200 Message-Id: <20180618092132.7253-4-kraxel@redhat.com> In-Reply-To: <20180618092132.7253-1-kraxel@redhat.com> References: <20180618092132.7253-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 3/3] Revert "bus: do not unref the added child bus on realize" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau This is wrong. object_finalize_child_property()'s unref balances the ref in object_property_add_child(). qbus_realize's unref balances the ref that was initially placed by object_new/object_initialize. This reverts commit f3d58385a6d3d82f65db602c5506e2d3d8c82394. Reported-by: Paolo Bonzini Signed-off-by: Marc-Andr=C3=A9 Lureau Message-id: 20180613172815.32738-4-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- hw/core/bus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/bus.c b/hw/core/bus.c index ad0c9df335..4651f24486 100644 --- a/hw/core/bus.c +++ b/hw/core/bus.c @@ -102,6 +102,7 @@ static void qbus_realize(BusState *bus, DeviceState *= parent, const char *name) QLIST_INSERT_HEAD(&bus->parent->child_bus, bus, sibling); bus->parent->num_child_bus++; object_property_add_child(OBJECT(bus->parent), bus->name, OBJECT= (bus), NULL); + object_unref(OBJECT(bus)); } else if (bus !=3D sysbus_get_default()) { /* TODO: once all bus devices are qdevified, only reset handler for main_system_bus should be registered h= ere. */ --=20 2.9.3