summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/CVE-2024-24474.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/CVE-2024-24474.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2024-24474.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2024-24474.patch b/meta/recipes-devtools/qemu/qemu/CVE-2024-24474.patch
new file mode 100644
index 0000000000..e890fe56cf
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2024-24474.patch
@@ -0,0 +1,44 @@
1From 77668e4b9bca03a856c27ba899a2513ddf52bb52 Mon Sep 17 00:00:00 2001
2From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
3Date: Wed, 13 Sep 2023 21:44:09 +0100
4Subject: [PATCH] esp: restrict non-DMA transfer length to that of available
5 data
6
7In the case where a SCSI layer transfer is incorrectly terminated, it is
8possible for a TI command to cause a SCSI buffer overflow due to the
9expected transfer data length being less than the available data in the
10FIFO. When this occurs the unsigned async_len variable underflows and
11becomes a large offset which writes past the end of the allocated SCSI
12buffer.
13
14Restrict the non-DMA transfer length to be the smallest of the expected
15transfer length and the available FIFO data to ensure that it is no longer
16possible for the SCSI buffer overflow to occur.
17
18Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
19Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1810
20Reviewed-by: Thomas Huth <thuth@redhat.com>
21Message-ID: <20230913204410.65650-3-mark.cave-ayland@ilande.co.uk>
22Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
23
24Upstream-Status: Backport [https://github.com/qemu/qemu/commit/77668e4b9bca03a856c27ba899a2513ddf52bb52]
25CVE: CVE-2024-24474
26Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
27---
28 hw/scsi/esp.c | 3 ++-
29 1 file changed, 2 insertions(+), 1 deletion(-)
30
31diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
32index 4218a6a96054..9b11d8c5738a 100644
33--- a/hw/scsi/esp.c
34+++ b/hw/scsi/esp.c
35@@ -759,7 +759,8 @@ static void esp_do_nodma(ESPState *s)
36 }
37
38 if (to_device) {
39- len = MIN(fifo8_num_used(&s->fifo), ESP_FIFO_SZ);
40+ len = MIN(s->async_len, ESP_FIFO_SZ);
41+ len = MIN(len, fifo8_num_used(&s->fifo));
42 esp_fifo_pop_buf(&s->fifo, s->async_buf, len);
43 s->async_buf += len;
44 s->async_len -= len;