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

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