diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-28 09:54:15 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-03-12 14:05:25 -0500 |
commit | 6c1fdcf902bb61920e0cf8476b213a85c0697c09 (patch) | |
tree | 9ea5f512b6bf7098adfc294bf48ad93fdf0287c4 /qom | |
parent | 66d341e54f7b81ff076ffd681ed574d557bd7495 (diff) |
qom: fix device hot-unplug
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>
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/qom/object.c b/qom/object.c index aa037d299..39cbcb9b7 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; } } } |