qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qdev: fix crash when device_add is called with


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] qdev: fix crash when device_add is called with abstract driver
Date: Tue, 17 Sep 2013 16:27:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

Il 17/09/2013 15:32, Igor Mammedov ha scritto:
> user is able to crash running QEMU when following monitor
> command is called:
> 
>  device_add intel-hda-generic
> 
> crash is caused by assertion in object_initialize_with_type()
> when type is abstract.
> 
> Checking if type is abstract before instance is created in
> qdev_device_add() allows to prevent crash on incorrect user input.
> 
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
>  qdev-monitor.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index 410cdcb..bb2e1b6 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -472,6 +472,12 @@ DeviceState *qdev_device_add(QemuOpts *opts)
>          return NULL;
>      }
>  
> +    if (object_class_is_abstract(obj)) {
> +        qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver",
> +                      "non-abstract device type");
> +        return NULL;
> +    }
> +
>      k = DEVICE_CLASS(obj);
>  
>      /* find bus */
> 

Looks good,

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]