From: Paolo Bonzini Date: Tue, 28 Feb 2012 08:54:15 +0000 (+0100) Subject: qom: fix device hot-unplug X-Git-Tag: v1.1-rc0~250 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c1fdcf902bb61920e0cf8476b213a85c0697c09;p=thirdparty%2Fqemu.git 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 Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- diff --git a/qom/object.c b/qom/object.c index aa037d299f7..39cbcb9b751 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; } } }