Blame SOURCES/kvm-display-qxl-render-fix-race-condition-in-qxl_cursor-.patch

6443c2
From 08103b26cb393920410e0a943d35e79bbd9f5ce0 Mon Sep 17 00:00:00 2001
6443c2
From: Jon Maloy <jmaloy@rehat.com>
6443c2
Date: Wed, 13 Apr 2022 20:54:45 -0400
6443c2
Subject: [PATCH 05/11] display/qxl-render: fix race condition in qxl_cursor
6443c2
 (CVE-2021-4207)
6443c2
MIME-Version: 1.0
6443c2
Content-Type: text/plain; charset=UTF-8
6443c2
Content-Transfer-Encoding: 8bit
6443c2
6443c2
RH-Author: Jon Maloy <jmaloy@redhat.com>
6443c2
RH-MergeRequest: 162: display/qxl-render: fix race condition in qxl_cursor (CVE-2021-4207)
6443c2
RH-Commit: [1/1] 055c5a8345ad434a723b8106ba0a7b85fe117547 (jmaloy/qemu-kvm)
6443c2
RH-Bugzilla: 2075683
6443c2
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
6443c2
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6443c2
RH-Acked-by: Mauro Matteo Cascella <None>
6443c2
6443c2
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2075683
6443c2
Upstream: Merged
6443c2
CVE: CVE-2021-4207
6443c2
6443c2
commit 9569f5cb5b4bffa9d3ebc8ba7da1e03830a9a895
6443c2
Author: Mauro Matteo Cascella <mcascell@redhat.com>
6443c2
Date:   Thu Apr 7 10:11:06 2022 +0200
6443c2
6443c2
    display/qxl-render: fix race condition in qxl_cursor (CVE-2021-4207)
6443c2
6443c2
    Avoid fetching 'width' and 'height' a second time to prevent possible
6443c2
    race condition. Refer to security advisory
6443c2
    https://starlabs.sg/advisories/22-4207/ for more information.
6443c2
6443c2
    Fixes: CVE-2021-4207
6443c2
    Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
6443c2
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6443c2
    Message-Id: <20220407081106.343235-1-mcascell@redhat.com>
6443c2
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6443c2
6443c2
(cherry picked from commit 9569f5cb5b4bffa9d3ebc8ba7da1e03830a9a895)
6443c2
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
6443c2
---
6443c2
 hw/display/qxl-render.c | 2 +-
6443c2
 1 file changed, 1 insertion(+), 1 deletion(-)
6443c2
6443c2
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
6443c2
index d28849b121..237ed293ba 100644
6443c2
--- a/hw/display/qxl-render.c
6443c2
+++ b/hw/display/qxl-render.c
6443c2
@@ -266,7 +266,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,
6443c2
         }
6443c2
         break;
6443c2
     case SPICE_CURSOR_TYPE_ALPHA:
6443c2
-        size = sizeof(uint32_t) * cursor->header.width * cursor->header.height;
6443c2
+        size = sizeof(uint32_t) * c->width * c->height;
6443c2
         qxl_unpack_chunks(c->data, size, qxl, &cursor->chunk, group_id);
6443c2
         if (qxl->debug > 2) {
6443c2
             cursor_print_ascii_art(c, "qxl/alpha");
6443c2
-- 
6443c2
2.27.0
6443c2