yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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