yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qga-fix-assert-regression-on-guest-shutdown.patch

a19a21
From 93b37bad75d14ed4b9e96cc3587d8ae16cb96ba3 Mon Sep 17 00:00:00 2001
709dde
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
a19a21
Date: Fri, 2 Oct 2020 17:46:08 -0400
a19a21
Subject: [PATCH 01/18] 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>
a19a21
Message-id: <20201002174608.943992-2-marcandre.lureau@redhat.com>
a19a21
Patchwork-id: 98534
a19a21
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 1/1] qga: fix assert regression on guest-shutdown
a19a21
Bugzilla: 1884531
a19a21
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
a19a21
RH-Acked-by: Thomas Huth <thuth@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