Blame SOURCES/kvm-hw-display-qxl-Have-qxl_log_command-Return-early-if-.patch

62547e
From 5ec8d909d40fa04ef2c3572e01509a1866786070 Mon Sep 17 00:00:00 2001
62547e
From: Jon Maloy <jmaloy@redhat.com>
62547e
Date: Mon, 5 Dec 2022 15:32:55 -0500
62547e
Subject: [PATCH 1/5] hw/display/qxl: Have qxl_log_command Return early if no
62547e
 log_cmd handler
62547e
MIME-Version: 1.0
62547e
Content-Type: text/plain; charset=UTF-8
62547e
Content-Transfer-Encoding: 8bit
62547e
62547e
RH-Author: Jon Maloy <jmaloy@redhat.com>
62547e
RH-MergeRequest: 240: hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler
62547e
RH-Bugzilla: 2148545
62547e
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
62547e
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
62547e
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
RH-Commit: [1/5] 33d94f40c46cccbc32d108d1035365917bf90356 (jmaloy/jons-qemu-kvm)
62547e
62547e
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2148545
62547e
CVE: CVE-2022-4144
62547e
Upstream: Merged
62547e
62547e
commit 61c34fc194b776ecadc39fb26b061331107e5599
62547e
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
62547e
Date:   Mon Nov 28 21:27:37 2022 +0100
62547e
62547e
    hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler
62547e
62547e
    Only 3 command types are logged: no need to call qxl_phys2virt()
62547e
    for the other types. Using different cases will help to pass
62547e
    different structure sizes to qxl_phys2virt() in a pair of commits.
62547e
62547e
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
62547e
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
62547e
    Message-Id: <20221128202741.4945-2-philmd@linaro.org>
62547e
62547e
(cherry picked from commit 61c34fc194b776ecadc39fb26b061331107e5599)
62547e
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
62547e
---
62547e
 hw/display/qxl-logger.c | 11 +++++++++++
62547e
 1 file changed, 11 insertions(+)
62547e
62547e
diff --git a/hw/display/qxl-logger.c b/hw/display/qxl-logger.c
62547e
index 68bfa47568..1bcf803db6 100644
62547e
--- a/hw/display/qxl-logger.c
62547e
+++ b/hw/display/qxl-logger.c
62547e
@@ -247,6 +247,16 @@ int qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext)
62547e
             qxl_name(qxl_type, ext->cmd.type),
62547e
             compat ? "(compat)" : "");
62547e
 
62547e
+    switch (ext->cmd.type) {
62547e
+    case QXL_CMD_DRAW:
62547e
+        break;
62547e
+    case QXL_CMD_SURFACE:
62547e
+        break;
62547e
+    case QXL_CMD_CURSOR:
62547e
+        break;
62547e
+    default:
62547e
+        goto out;
62547e
+    }
62547e
     data = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
62547e
     if (!data) {
62547e
         return 1;
62547e
@@ -269,6 +279,7 @@ int qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext)
62547e
         qxl_log_cmd_cursor(qxl, data, ext->group_id);
62547e
         break;
62547e
     }
62547e
+out:
62547e
     fprintf(stderr, "\n");
62547e
     return 0;
62547e
 }
62547e
-- 
62547e
2.37.3
62547e