From patchwork Fri May 11 02:15:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 158422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 935EBB6FC3 for ; Fri, 11 May 2012 12:15:33 +1000 (EST) Received: from localhost ([::1]:52491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSfOF-0005zi-BO for incoming@patchwork.ozlabs.org; Thu, 10 May 2012 22:15:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSfO8-0005z4-5B for qemu-devel@nongnu.org; Thu, 10 May 2012 22:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSfO6-0000Pb-HG for qemu-devel@nongnu.org; Thu, 10 May 2012 22:15:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSfO6-0000Om-9T for qemu-devel@nongnu.org; Thu, 10 May 2012 22:15:22 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4B2FJHH007083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 May 2012 22:15:20 -0400 Received: from [10.66.8.167] (dhcp-8-167.nay.redhat.com [10.66.8.167]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4B2FHcf017962; Thu, 10 May 2012 22:15:18 -0400 To: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org From: Amos Kong Date: Fri, 11 May 2012 10:15:31 +0800 Message-ID: <20120511021531.14819.78211.stgit@t> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] qom: fix refcounting in object_property_del_child() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Start VM with 8 multiple-function block devs, hot-removing those block devs by 'device_del ...' would cause qemu abort. object_ref() is called in object_property_add_child(), but we don't unref it in object_property_del_child(). | (qemu) device_del virti0-0-0 | (qemu) ** | ERROR:qom/object.c:389:object_delete: assertion failed: (obj->ref == 0) Signed-off-by: Amos Kong --- qom/object.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/qom/object.c b/qom/object.c index e721fc2..9da6b59 100644 --- a/qom/object.c +++ b/qom/object.c @@ -320,6 +320,7 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) QTAILQ_FOREACH(prop, &obj->properties, node) { if (strstart(prop->type, "child<", NULL) && prop->opaque == child) { object_property_del(obj, prop->name, errp); + object_unref(child); break; } }