All of lore.kernel.org
 help / color / mirror / Atom feed
From: <arei.gonglei@huawei.com>
To: qemu-devel@nongnu.org
Cc: weidong.huang@huawei.com, aliguori@amazon.com, mst@redhat.com,
	armbru@redhat.com, luonengjun@huawei.com,
	peter.huangpeng@huawei.com, lcapitulino@redhat.com,
	Gonglei <arei.gonglei@huawei.com>,
	stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 2/7] qom: add error handler for object alias property
Date: Tue, 23 Sep 2014 21:08:32 +0800	[thread overview]
Message-ID: <1411477717-6988-3-git-send-email-arei.gonglei@huawei.com> (raw)
In-Reply-To: <1411477717-6988-1-git-send-email-arei.gonglei@huawei.com>

From: Gonglei <arei.gonglei@huawei.com>

object_property_add_alias() is called at some
places at present. And its parameter errp may not NULL,
such as
 object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothread",
                              &error_abort);
This patch add error handler for security.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qom/object.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/qom/object.c b/qom/object.c
index 74779e6..81542fb 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1642,6 +1642,7 @@ void object_property_add_alias(Object *obj, const char *name,
     ObjectProperty *op;
     ObjectProperty *target_prop;
     gchar *prop_type;
+    Error *local_err = NULL;
 
     target_prop = object_property_find(target_obj, target_name, errp);
     if (!target_prop) {
@@ -1663,9 +1664,15 @@ void object_property_add_alias(Object *obj, const char *name,
                              property_get_alias,
                              property_set_alias,
                              property_release_alias,
-                             prop, errp);
+                             prop, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        g_free(prop);
+        goto out;
+    }
     op->resolve = property_resolve_alias;
 
+out:
     g_free(prop_type);
 }
 
-- 
1.7.12.4

  parent reply	other threads:[~2014-09-23 13:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 13:08 [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 1/7] qom: add error handler for object_property_print() arei.gonglei
2014-09-23 13:08 ` arei.gonglei [this message]
2014-09-23 13:08 ` [Qemu-devel] [PATCH 3/7] qdev: add description field in PropertyInfo struct arei.gonglei
2014-09-24 13:01   ` Paolo Bonzini
2014-09-24 13:56     ` Gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 4/7] qom: add description field in ObjectProperty struct arei.gonglei
2014-09-23 13:38   ` Gonglei (Arei)
2014-09-23 13:08 ` [Qemu-devel] [PATCH 5/7] qdev: set the object property's description to the qdev property's arei.gonglei
2014-09-23 17:03   ` Paolo Bonzini
2014-09-24  0:42     ` Gonglei (Arei)
2014-09-24  6:54       ` Paolo Bonzini
2014-09-24  8:34         ` Gonglei (Arei)
2014-09-24  9:12         ` Gonglei (Arei)
2014-09-24 11:06           ` Paolo Bonzini
2014-09-23 13:08 ` [Qemu-devel] [PATCH 6/7] qmp: print descriptions of object properties arei.gonglei
2014-09-23 13:08 ` [Qemu-devel] [PATCH 7/7] qdev: drop legacy_name from qdev properties arei.gonglei
2014-09-23 17:03 ` [Qemu-devel] [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct Paolo Bonzini
2014-09-24  0:44   ` Gonglei (Arei)
2014-09-24 12:36     ` Gonglei

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=1411477717-6988-3-git-send-email-arei.gonglei@huawei.com \
    --to=arei.gonglei@huawei.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.