cryptospore / rpms / qemu-kvm

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