From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFD81C433E0 for ; Tue, 9 Jun 2020 11:20:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A17DD207F9 for ; Tue, 9 Jun 2020 11:20:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A17DD207F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jicJ2-000126-OM for qemu-devel@archiver.kernel.org; Tue, 09 Jun 2020 07:20:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jicEf-0004MV-3x for qemu-devel@nongnu.org; Tue, 09 Jun 2020 07:16:06 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:52595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1jicEd-0002re-1y for qemu-devel@nongnu.org; Tue, 09 Jun 2020 07:16:04 -0400 Received: from mail-ua1-f72.google.com ([209.85.222.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jicEa-0005BP-7c for qemu-devel@nongnu.org; Tue, 09 Jun 2020 11:16:00 +0000 Received: by mail-ua1-f72.google.com with SMTP id z22so7734838uam.19 for ; Tue, 09 Jun 2020 04:16:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oBhDRxmjvs3r+x2JBEPIEKih8R2LG/6YLL/TgHpysBo=; b=J0TfZ/mpaiOvUzVHw4AR5VUl5gCx8bNHa6ClBZZf4lVhAIKGvBROQWcje8YWTkRAeV ZQXDD3GV3uvGN6UWcdTaX0/2tu8XTIEa30f8BSbRp0lkK0vGZndLeiI7oKfey39ScHiB zEljwMsapdtWUOU/KCXEVroBXL31MCxUpwH2c75KI67SqjMwEF7W7K4MOiPoX4fobb7D hkSuYjUTNyPBJGT5PZLhXsS5pLI7opLdJYEyFNXMzVVouEhL7EFiC+Varj5u6BQa/tnW 1B2b0SluPhFCD4L73+SYMdvVBlmjVcYf/4uqLxOMlwuoIVfvMYbouRZ1hAJHq/BBX4s6 VH2Q== X-Gm-Message-State: AOAM53375nu785Pmsvb0x2iZyo8QI1ORjmMnwE/A5qjHm18JZQFEfEH7 p3fESD23yvnW144OsVblYxIR+BxHOZOuCcw6MxLN4zp+gG6G91N3N75djsWs86LyPy92rqRJ8KO vMq8bVA9T2FlTUhKOITVlWjepKUsSCDZpQC816NXzokD1y3jx X-Received: by 2002:a9f:3603:: with SMTP id r3mr2177768uad.102.1591701359307; Tue, 09 Jun 2020 04:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmaGQFxOhx2Yn4JL5g8p7sivi95iRaCunk5hZ3CB0BeYUrBILM+ESNko7eTRcj30ZNE5FuqjbRjtkxkTiew9U= X-Received: by 2002:a9f:3603:: with SMTP id r3mr2177754uad.102.1591701358999; Tue, 09 Jun 2020 04:15:58 -0700 (PDT) MIME-Version: 1.0 References: <20200604094425.63020-1-marcandre.lureau@redhat.com> In-Reply-To: From: Christian Ehrhardt Date: Tue, 9 Jun 2020 13:15:33 +0200 Message-ID: Subject: Re: [PATCH] qga: fix assert regression on guest-shutdown To: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Content-Type: multipart/alternative; boundary="00000000000017a5e305a7a4dabc" Received-SPF: none client-ip=91.189.89.112; envelope-from=christian.ehrhardt@canonical.com; helo=youngberry.canonical.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/09 07:16:00 X-ACL-Warn: Detected OS = Linux 3.1-3.10 X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel , Michael Roth Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --00000000000017a5e305a7a4dabc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 4, 2020 at 3:43 PM Christian Ehrhardt < christian.ehrhardt@canonical.com> wrote: > > > On Thu, Jun 4, 2020 at 11:46 AM Marc-Andr=C3=A9 Lureau < > marcandre.lureau@redhat.com> 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 >> Reported-by: Christian Ehrhardt >> Signed-off-by: Marc-Andr=C3=A9 Lureau >> --- >> 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; >> + } >> >> >> > Thanks Marc-Andr=C3=A9, > LGTM and should fix the issues I was seeing. > > Reviewed-by: Christian Ehrhardt > In the meantime I also got to test this against the initially reported issue, LGTM as well (ran as no-change backport onto 4.2). Tested-by: Christian Ehrhardt --00000000000017a5e305a7a4dabc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Jun 4, 2020 at 3:43 PM Christ= ian Ehrhardt <christ= ian.ehrhardt@canonical.com> wrote:


<= div class=3D"gmail_quote">
On Thu, Jun= 4, 2020 at 11:46 AM Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com> w= rote:
Since comm= it 781f2b3d1e ("qga: process_event() simplification"),
send_response() is called unconditionally, but will assert when "rsp&q= uot; 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=C3=A9 Lureau <marcandre.lureau@redhat.com>
---
=C2=A0qga/main.c | 6 +++++-
=C2=A01 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)=
=C2=A0 =C2=A0 =C2=A0QString *payload_qstr, *response_qstr;
=C2=A0 =C2=A0 =C2=A0GIOStatus status;

-=C2=A0 =C2=A0 g_assert(rsp && s->channel);
+=C2=A0 =C2=A0 g_assert(s->channel);
+
+=C2=A0 =C2=A0 if (!rsp) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
+=C2=A0 =C2=A0 }



Thanks Marc-Andr=C3=A9,
LG= TM and should fix the issues I was seeing.

Revi= ewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>

In the meantime I also got to test thi= s against the initially reported issue, LGTM as well (ran as no-change back= port onto 4.2).

Tested-by: Christian Ehrhardt <= chris= tian.ehrhardt@canonical.com>
--00000000000017a5e305a7a4dabc--