* [Qemu-devel] [PATCH 0/2] qom: add error handler for security
@ 2014-09-23 3:25 arei.gonglei
2014-09-23 3:25 ` [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print() arei.gonglei
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: arei.gonglei @ 2014-09-23 3:25 UTC (permalink / raw)
To: qemu-devel; +Cc: weidong.huang, luonengjun, armbru, Gonglei, pbonzini, afaerber
From: Gonglei <arei.gonglei@huawei.com>
The PATCH 2 is splited from another patch series, which has been
reviewed by Paolo. PATCH 1 can avoid possible leaking memory.
Gonglei (2):
qom: add error handler for object_property_print()
qom: add error handler for object alias property
qom/object.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print()
2014-09-23 3:25 [Qemu-devel] [PATCH 0/2] qom: add error handler for security arei.gonglei
@ 2014-09-23 3:25 ` arei.gonglei
2014-09-23 13:16 ` Andreas Färber
2014-09-23 3:25 ` [Qemu-devel] [PATCH 2/2] qom: add error handler for object alias property arei.gonglei
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: arei.gonglei @ 2014-09-23 3:25 UTC (permalink / raw)
To: qemu-devel; +Cc: weidong.huang, luonengjun, armbru, Gonglei, pbonzini, afaerber
From: Gonglei <arei.gonglei@huawei.com>
Avoid the caller of object_property_print() leaking string
argument's memory, such as qdev_print_props() when
encounter errors.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
qom/object.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index da0919a..74779e6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1010,11 +1010,19 @@ char *object_property_print(Object *obj, const char *name, bool human,
Error **errp)
{
StringOutputVisitor *mo;
- char *string;
+ char *string = NULL;
+ Error *local_err = NULL;
mo = string_output_visitor_new(human);
- object_property_get(obj, string_output_get_visitor(mo), name, errp);
+ object_property_get(obj, string_output_get_visitor(mo), name, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ goto fail;
+ }
+
string = string_output_get_string(mo);
+
+fail:
string_output_visitor_cleanup(mo);
return string;
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 2/2] qom: add error handler for object alias property
2014-09-23 3:25 [Qemu-devel] [PATCH 0/2] qom: add error handler for security arei.gonglei
2014-09-23 3:25 ` [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print() arei.gonglei
@ 2014-09-23 3:25 ` arei.gonglei
2014-09-23 3:51 ` [Qemu-devel] [PATCH 0/2] qom: add error handler for security Eric Blake
2014-09-23 13:11 ` Paolo Bonzini
3 siblings, 0 replies; 11+ messages in thread
From: arei.gonglei @ 2014-09-23 3:25 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, Michael S. Tsirkin, luonengjun, armbru, Gonglei,
Stefan Hajnoczi, pbonzini, afaerber
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
2014-09-23 3:25 [Qemu-devel] [PATCH 0/2] qom: add error handler for security arei.gonglei
2014-09-23 3:25 ` [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print() arei.gonglei
2014-09-23 3:25 ` [Qemu-devel] [PATCH 2/2] qom: add error handler for object alias property arei.gonglei
@ 2014-09-23 3:51 ` Eric Blake
2014-09-23 3:56 ` Gonglei (Arei)
2014-09-23 13:11 ` Paolo Bonzini
3 siblings, 1 reply; 11+ messages in thread
From: Eric Blake @ 2014-09-23 3:51 UTC (permalink / raw)
To: arei.gonglei, qemu-devel
Cc: luonengjun, weidong.huang, armbru, afaerber, pbonzini
[-- Attachment #1: Type: text/plain, Size: 414 bytes --]
On 09/22/2014 09:25 PM, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> The PATCH 2 is splited from another patch series, which has been
s/splited/split/
'split' is one of those stupid English words whose past tense is spelled
identically to its present tense.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
2014-09-23 3:51 ` [Qemu-devel] [PATCH 0/2] qom: add error handler for security Eric Blake
@ 2014-09-23 3:56 ` Gonglei (Arei)
0 siblings, 0 replies; 11+ messages in thread
From: Gonglei (Arei) @ 2014-09-23 3:56 UTC (permalink / raw)
To: Eric Blake, qemu-devel
Cc: Luonengjun, Huangweidong (C), armbru, afaerber, pbonzini
> Subject: Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
>
> On 09/22/2014 09:25 PM, arei.gonglei@huawei.com wrote:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > The PATCH 2 is splited from another patch series, which has been
>
> s/splited/split/
>
> 'split' is one of those stupid English words whose past tense is spelled
> identically to its present tense.
>
Hmm.. Thanks!
Best regards,
-Gonglei
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
2014-09-23 3:25 [Qemu-devel] [PATCH 0/2] qom: add error handler for security arei.gonglei
` (2 preceding siblings ...)
2014-09-23 3:51 ` [Qemu-devel] [PATCH 0/2] qom: add error handler for security Eric Blake
@ 2014-09-23 13:11 ` Paolo Bonzini
2014-09-23 13:21 ` Gonglei (Arei)
3 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2014-09-23 13:11 UTC (permalink / raw)
To: arei.gonglei, qemu-devel; +Cc: luonengjun, weidong.huang, armbru, afaerber
Il 23/09/2014 05:25, arei.gonglei@huawei.com ha scritto:
> From: Gonglei <arei.gonglei@huawei.com>
>
> The PATCH 2 is splited from another patch series, which has been
> reviewed by Paolo. PATCH 1 can avoid possible leaking memory.
>
> Gonglei (2):
> qom: add error handler for object_property_print()
> qom: add error handler for object alias property
>
> qom/object.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Andreas, can you queue it in qom-next?
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print()
2014-09-23 3:25 ` [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print() arei.gonglei
@ 2014-09-23 13:16 ` Andreas Färber
2014-09-23 13:25 ` Gonglei (Arei)
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2014-09-23 13:16 UTC (permalink / raw)
To: arei.gonglei, qemu-devel; +Cc: luonengjun, weidong.huang, armbru, pbonzini
Hi,
Am 23.09.2014 um 05:25 schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
>
> Avoid the caller of object_property_print() leaking string
> argument's memory, such as qdev_print_props() when
> encounter errors.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> qom/object.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index da0919a..74779e6 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -1010,11 +1010,19 @@ char *object_property_print(Object *obj, const char *name, bool human,
> Error **errp)
> {
> StringOutputVisitor *mo;
> - char *string;
> + char *string = NULL;
> + Error *local_err = NULL;
>
> mo = string_output_visitor_new(human);
> - object_property_get(obj, string_output_get_visitor(mo), name, errp);
> + object_property_get(obj, string_output_get_visitor(mo), name, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + goto fail;
> + }
> +
> string = string_output_get_string(mo);
> +
> +fail:
Permission to rename the label to "out" as in 2/2?
Series looks good otherwise.
Regards,
Andreas
> string_output_visitor_cleanup(mo);
> return string;
> }
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
2014-09-23 13:11 ` Paolo Bonzini
@ 2014-09-23 13:21 ` Gonglei (Arei)
2014-09-23 13:22 ` Paolo Bonzini
0 siblings, 1 reply; 11+ messages in thread
From: Gonglei (Arei) @ 2014-09-23 13:21 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Luonengjun, Huangweidong (C), armbru, afaerber
> >
> > The PATCH 2 is splited from another patch series, which has been
> > reviewed by Paolo. PATCH 1 can avoid possible leaking memory.
> >
> > Gonglei (2):
> > qom: add error handler for object_property_print()
> > qom: add error handler for object alias property
> >
> > qom/object.c | 21 ++++++++++++++++++---
> > 1 file changed, 18 insertions(+), 3 deletions(-)
> >
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
Thanks, Paolo. I merged those two patches in my next patch series
[PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
because of depending. Maybe I should spilt them again?
Best regards,
-Gonglei
> Andreas, can you queue it in qom-next?
>
> Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
2014-09-23 13:21 ` Gonglei (Arei)
@ 2014-09-23 13:22 ` Paolo Bonzini
2014-09-23 13:24 ` Gonglei (Arei)
0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2014-09-23 13:22 UTC (permalink / raw)
To: Gonglei (Arei), qemu-devel; +Cc: Luonengjun, Huangweidong (C), armbru, afaerber
Il 23/09/2014 15:21, Gonglei (Arei) ha scritto:
> Thanks, Paolo. I merged those two patches in my next patch series
> [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
> because of depending. Maybe I should spilt them again?
No, don't worry. Maintainers will handle it just fine.
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] qom: add error handler for security
2014-09-23 13:22 ` Paolo Bonzini
@ 2014-09-23 13:24 ` Gonglei (Arei)
0 siblings, 0 replies; 11+ messages in thread
From: Gonglei (Arei) @ 2014-09-23 13:24 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Luonengjun, Huangweidong (C), armbru, afaerber
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Tuesday, September 23, 2014 9:23 PM
> Subject: Re: [PATCH 0/2] qom: add error handler for security
>
> Il 23/09/2014 15:21, Gonglei (Arei) ha scritto:
> > Thanks, Paolo. I merged those two patches in my next patch series
> > [PATCH 0/7] add description field in ObjectProperty and PropertyInfo struct
> > because of depending. Maybe I should spilt them again?
>
> No, don't worry. Maintainers will handle it just fine.
>
> Paolo
OK , Thanks. :)
Best regards,
-Gonglei
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print()
2014-09-23 13:16 ` Andreas Färber
@ 2014-09-23 13:25 ` Gonglei (Arei)
0 siblings, 0 replies; 11+ messages in thread
From: Gonglei (Arei) @ 2014-09-23 13:25 UTC (permalink / raw)
To: Andreas Färber, qemu-devel
Cc: Luonengjun, Huangweidong (C), armbru, pbonzini
> Subject: Re: [Qemu-devel] [PATCH 1/2] qom: add error handler for
> object_property_print()
>
> Hi,
>
> Am 23.09.2014 um 05:25 schrieb arei.gonglei@huawei.com:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > Avoid the caller of object_property_print() leaking string
> > argument's memory, such as qdev_print_props() when
> > encounter errors.
> >
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> > ---
> > qom/object.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/qom/object.c b/qom/object.c
> > index da0919a..74779e6 100644
> > --- a/qom/object.c
> > +++ b/qom/object.c
> > @@ -1010,11 +1010,19 @@ char *object_property_print(Object *obj, const
> char *name, bool human,
> > Error **errp)
> > {
> > StringOutputVisitor *mo;
> > - char *string;
> > + char *string = NULL;
> > + Error *local_err = NULL;
> >
> > mo = string_output_visitor_new(human);
> > - object_property_get(obj, string_output_get_visitor(mo), name, errp);
> > + object_property_get(obj, string_output_get_visitor(mo), name,
> &local_err);
> > + if (local_err) {
> > + error_propagate(errp, local_err);
> > + goto fail;
> > + }
> > +
> > string = string_output_get_string(mo);
> > +
> > +fail:
>
> Permission to rename the label to "out" as in 2/2?
>
OK. Thanks. Will do. :)
Best regards,
-Gonglei
> Series looks good otherwise.
>
> Regards,
> Andreas
>
> > string_output_visitor_cleanup(mo);
> > return string;
> > }
> >
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-09-23 13:25 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 3:25 [Qemu-devel] [PATCH 0/2] qom: add error handler for security arei.gonglei
2014-09-23 3:25 ` [Qemu-devel] [PATCH 1/2] qom: add error handler for object_property_print() arei.gonglei
2014-09-23 13:16 ` Andreas Färber
2014-09-23 13:25 ` Gonglei (Arei)
2014-09-23 3:25 ` [Qemu-devel] [PATCH 2/2] qom: add error handler for object alias property arei.gonglei
2014-09-23 3:51 ` [Qemu-devel] [PATCH 0/2] qom: add error handler for security Eric Blake
2014-09-23 3:56 ` Gonglei (Arei)
2014-09-23 13:11 ` Paolo Bonzini
2014-09-23 13:21 ` Gonglei (Arei)
2014-09-23 13:22 ` Paolo Bonzini
2014-09-23 13:24 ` Gonglei (Arei)
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.