Patchwork weird qdev error

login
register
mail settings
Submitter Michael S. Tsirkin
Date Feb. 13, 2012, 4:58 a.m.
Message ID <20120213045807.GA22676@redhat.com>
Download mbox | patch
Permalink /patch/140851/
State New
Headers show

Comments

Michael S. Tsirkin - Feb. 13, 2012, 4:58 a.m.
On Mon, Feb 13, 2012 at 03:18:13AM +0200, Michael S. Tsirkin wrote:
> > I also see this:
> > 
> > device_add virtio-net-pci,netdev=foo,mac=52:54:00:12:34:56,id=bla
> > device_del bla
> > *** glibc detected *** /home/mst/qemu-test/bin/qemu-system-x86_64:
> > corrupted double-linked list: 0x00007fae434565a0 ***
> > 
> > Am I alone?

Doesn't solve this issue, but shouldn't we use _SAFE
in object_property_del_child? Like this:

--->
qemu: use safe list macro

As we might remove an element from list, use the safe macro
to walk it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---
Paolo Bonzini - Feb. 13, 2012, 10:19 a.m.
On 02/13/2012 05:58 AM, Michael S. Tsirkin wrote:
> Doesn't solve this issue, but shouldn't we use _SAFE
> in object_property_del_child? Like this:
>
> --->
> qemu: use safe list macro
>
> As we might remove an element from list, use the safe macro
> to walk it.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ---
>
> diff --git a/qom/object.c b/qom/object.c
> index 5e5b261..8b64fb6 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -299,9 +299,9 @@ static void object_property_del_all(Object *obj)
>
>  static void object_property_del_child(Object *obj, Object *child, Error **errp)
>  {
> -    ObjectProperty *prop;
> +    ObjectProperty *prop, *next;
>
> -    QTAILQ_FOREACH(prop, &obj->properties, node) {
> +    QTAILQ_FOREACH_SAFE(prop, &obj->properties, node, next) {
>          if (!strstart(prop->type, "child<", NULL)) {
>              continue;
>          }

Yup, I thought I had pointed this out in a review of Anthony's QOM series...

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

Patch

diff --git a/qom/object.c b/qom/object.c
index 5e5b261..8b64fb6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -299,9 +299,9 @@  static void object_property_del_all(Object *obj)
 
 static void object_property_del_child(Object *obj, Object *child, Error **errp)
 {
-    ObjectProperty *prop;
+    ObjectProperty *prop, *next;
 
-    QTAILQ_FOREACH(prop, &obj->properties, node) {
+    QTAILQ_FOREACH_SAFE(prop, &obj->properties, node, next) {
         if (!strstart(prop->type, "child<", NULL)) {
             continue;
         }