cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
709dde
From 1f47578a5af4e7d4e1587d2334a07e867cf819d4 Mon Sep 17 00:00:00 2001
709dde
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
709dde
Date: Tue, 24 Nov 2020 08:43:38 -0500
709dde
Subject: [PATCH] qga: fix assert regression on guest-shutdown
709dde
MIME-Version: 1.0
709dde
Content-Type: text/plain; charset=UTF-8
709dde
Content-Transfer-Encoding: 8bit
709dde
709dde
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
709dde
Message-id: <20201124084338.199348-2-marcandre.lureau@redhat.com>
709dde
Patchwork-id: 99877
709dde
O-Subject: [RHEL-8.3.0.z qemu-kvm PATCH 1/1] qga: fix assert regression on guest-shutdown
709dde
Bugzilla: 1900578
709dde
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
709dde
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
709dde
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
709dde
709dde
From: Marc-André Lureau <marcandre.lureau@redhat.com>
709dde
709dde
Since commit 781f2b3d1e ("qga: process_event() simplification"),
709dde
send_response() is called unconditionally, but will assert when "rsp" is
709dde
NULL. This may happen with QCO_NO_SUCCESS_RESP commands, such as
709dde
"guest-shutdown".
709dde
709dde
Fixes: 781f2b3d1e5ef389b44016a897fd55e7a780bf35
709dde
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
709dde
Reported-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
709dde
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
709dde
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
709dde
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
709dde
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
709dde
Cc: qemu-stable@nongnu.org
709dde
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
709dde
709dde
(cherry picked from commit 844bd70b5652f30bbace89499f513e3fbbb6457a)
709dde
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
709dde
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
709dde
---
709dde
 qga/main.c | 6 +++++-
709dde
 1 file changed, 5 insertions(+), 1 deletion(-)
709dde
709dde
diff --git a/qga/main.c b/qga/main.c
709dde
index c35c2a21209..12fa463f4cd 100644
709dde
--- a/qga/main.c
709dde
+++ b/qga/main.c
709dde
@@ -529,7 +529,11 @@ static int send_response(GAState *s, const QDict *rsp)
709dde
     QString *payload_qstr, *response_qstr;
709dde
     GIOStatus status;
709dde
 
709dde
-    g_assert(rsp && s->channel);
709dde
+    g_assert(s->channel);
709dde
+
709dde
+    if (!rsp) {
709dde
+        return 0;
709dde
+    }
709dde
 
709dde
     payload_qstr = qobject_to_json(QOBJECT(rsp));
709dde
     if (!payload_qstr) {
709dde
-- 
709dde
2.27.0
709dde