From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2IpP-0007bR-Vn for qemu-devel@nongnu.org; Tue, 28 Feb 2012 03:54:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2IpO-0004w8-5D for qemu-devel@nongnu.org; Tue, 28 Feb 2012 03:54:35 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:53931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2IpN-0004vJ-SY for qemu-devel@nongnu.org; Tue, 28 Feb 2012 03:54:34 -0500 Received: by mail-pz0-f45.google.com with SMTP id p14so7451488dad.4 for ; Tue, 28 Feb 2012 00:54:32 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 28 Feb 2012 09:54:15 +0100 Message-Id: <1330419255-5566-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1330419255-5566-1-git-send-email-pbonzini@redhat.com> References: <1330419255-5566-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] qom: fix device hot-unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" Property removal modifies the list, so it is not safe to continue iteration. We know anyway that each object can have only one parent (see object_property_add_child), so exit after finding the requested object. Reported-by: Michael S. Tsirkin Signed-off-by: Paolo Bonzini --- qom/object.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/qom/object.c b/qom/object.c index aa037d2..39cbcb9 100644 --- a/qom/object.c +++ b/qom/object.c @@ -304,12 +304,9 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) ObjectProperty *prop; QTAILQ_FOREACH(prop, &obj->properties, node) { - if (!strstart(prop->type, "child<", NULL)) { - continue; - } - - if (prop->opaque == child) { + if (strstart(prop->type, "child<", NULL) && prop->opaque == child) { object_property_del(obj, prop->name, errp); + break; } } } -- 1.7.7.6