]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qom: fix device hot-unplug
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 28 Feb 2012 08:54:15 +0000 (09:54 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 12 Mar 2012 19:05:25 +0000 (14:05 -0500)
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 <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom/object.c

index aa037d299f7fa596c6784965b6c698ef2c2e287e..39cbcb9b7519a9b5472c746645ca3ab7d07490d6 100644 (file)
@@ -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;
         }
     }
 }