From patchwork Tue Sep 23 13:08:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 392494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D2D34140092 for ; Tue, 23 Sep 2014 23:10:28 +1000 (EST) Received: from localhost ([::1]:53304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWPrO-0002lO-M9 for incoming@patchwork.ozlabs.org; Tue, 23 Sep 2014 09:10:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWPqH-0000ta-RF for qemu-devel@nongnu.org; Tue, 23 Sep 2014 09:09:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWPqC-0002bc-RP for qemu-devel@nongnu.org; Tue, 23 Sep 2014 09:09:17 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:49739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWPqC-0002aX-54 for qemu-devel@nongnu.org; Tue, 23 Sep 2014 09:09:12 -0400 Received: from 172.24.2.119 (EHLO szxeml451-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AUS85231; Tue, 23 Sep 2014 21:08:53 +0800 (CST) Received: from localhost (10.177.19.102) by szxeml451-hub.china.huawei.com (10.82.67.194) with Microsoft SMTP Server id 14.3.158.1; Tue, 23 Sep 2014 21:08:44 +0800 From: To: Date: Tue, 23 Sep 2014 21:08:32 +0800 Message-ID: <1411477717-6988-3-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 In-Reply-To: <1411477717-6988-1-git-send-email-arei.gonglei@huawei.com> References: <1411477717-6988-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.19.102] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.542170E5.0200, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b60f5390536175fd9037eec44144d96c X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 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 , stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 2/7] qom: add error handler for object alias property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gonglei 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 Cc: Paolo Bonzini Cc: Michael S. Tsirkin Cc: Markus Armbruster Signed-off-by: Gonglei Reviewed-by: Paolo Bonzini --- 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); }