thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
62547e
From 100f33ff8a1d55986e43b99ba8726abc29ee8d26 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 5/5] hw/display/qxl: Assert memory slot fits in preallocated
62547e
 MemoryRegion
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: [5/5] f809ce48e7989dd6547b7c8bf1a5efc3fdcacbac (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 86fdb0582c653a9824183679403a85f588260d62
62547e
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
62547e
Date:   Mon Nov 28 21:27:41 2022 +0100
62547e
62547e
    hw/display/qxl: Assert memory slot fits in preallocated MemoryRegion
62547e
62547e
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
62547e
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
62547e
    Message-Id: <20221128202741.4945-6-philmd@linaro.org>
62547e
62547e
(cherry picked from commit 86fdb0582c653a9824183679403a85f588260d62)
62547e
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
62547e
---
62547e
 hw/display/qxl.c | 1 +
62547e
 1 file changed, 1 insertion(+)
62547e
62547e
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
62547e
index 2a4b2d4158..bcd9e8716a 100644
62547e
--- a/hw/display/qxl.c
62547e
+++ b/hw/display/qxl.c
62547e
@@ -1372,6 +1372,7 @@ static int qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta,
62547e
         qxl_set_guest_bug(d, "%s: pci_region = %d", __func__, pci_region);
62547e
         return 1;
62547e
     }
62547e
+    assert(guest_end - pci_start <= memory_region_size(mr));
62547e
 
62547e
     virt_start = (intptr_t)memory_region_get_ram_ptr(mr);
62547e
     memslot.slot_id = slot_id;
62547e
-- 
62547e
2.37.3
62547e