Il 15/09/2014 16:44, arei.gong...@huawei.com ha scritto:
> From: Gonglei <arei.gong...@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 <stefa...@redhat.com>
> Cc: Paolo Bonzini <pbonz...@redhat.com>
> Cc: Michael S. Tsirkin <m...@redhat.com>
> Signed-off-by: Gonglei <arei.gong...@huawei.com>
> ---
>  qom/object.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index da0919a..e7b16a1 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -1634,6 +1634,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) {
> @@ -1655,9 +1656,14 @@ 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);
> +        goto out;
> +    }
>      op->resolve = property_resolve_alias;
>  
> +out:
>      g_free(prop_type);
>  }
>  
> 

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

Reply via email to