qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] qom: fix device hot-unplug
Date: Tue, 28 Feb 2012 09:54:15 +0100	[thread overview]
Message-ID: <1330419255-5566-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1330419255-5566-1-git-send-email-pbonzini@redhat.com>

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>
---
 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

  parent reply	other threads:[~2012-02-28  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28  8:54 [Qemu-devel] [PATCH 0/2] Two small QOM fixes Paolo Bonzini
2012-02-28  8:54 ` [Qemu-devel] [PATCH 1/2] qdev: accept empty string properties Paolo Bonzini
2012-02-28 18:53   ` Gerhard Wiesinger
2012-03-10 13:14   ` Andreas Färber
2012-02-28  8:54 ` Paolo Bonzini [this message]
2012-03-10 13:12   ` [Qemu-devel] [PATCH 2/2] qom: fix device hot-unplug Andreas Färber
2012-03-09 20:15 ` [Qemu-devel] [PATCH 0/2] Two small QOM fixes Paolo Bonzini
2012-03-13  1:59 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330419255-5566-3-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).