qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] qga: fix assert regression on guest-shutdown


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] qga: fix assert regression on guest-shutdown
Date: Thu, 4 Jun 2020 12:09:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 6/4/20 11:44 AM, Marc-André Lureau wrote:
> Since commit 781f2b3d1e ("qga: process_event() simplification"),
> send_response() is called unconditionally, but will assert when "rsp" is
> NULL. This may happen with QCO_NO_SUCCESS_RESP commands, such as
> "guest-shutdown".
> 
> Fixes: 781f2b3d1e5ef389b44016a897fd55e7a780bf35
> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
> Reported-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qga/main.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/qga/main.c b/qga/main.c
> index f0e454f28d3..3febf3b0fdf 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -531,7 +531,11 @@ static int send_response(GAState *s, const QDict *rsp)
>      QString *payload_qstr, *response_qstr;
>      GIOStatus status;
>  
> -    g_assert(rsp && s->channel);
> +    g_assert(s->channel);
> +
> +    if (!rsp) {
> +        return 0;
> +    }

Why not assert after the check?

Anyway:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>  
>      payload_qstr = qobject_to_json(QOBJECT(rsp));
>      if (!payload_qstr) {
> 




reply via email to

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