cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
6e7d01
From 0e9bdb960045f98d70f765bbb585f1647e5fea08 Mon Sep 17 00:00:00 2001
6e7d01
From: Thomas Huth <thuth@redhat.com>
6e7d01
Date: Tue, 18 May 2021 13:51:23 -0400
6e7d01
Subject: [PATCH 3/5] pc-bios/s390-ccw: fix off-by-one error
6e7d01
MIME-Version: 1.0
6e7d01
Content-Type: text/plain; charset=UTF-8
6e7d01
Content-Transfer-Encoding: 8bit
6e7d01
6e7d01
RH-Author: Thomas Huth <thuth@redhat.com>
6e7d01
Message-id: <20210518135125.191329-2-thuth@redhat.com>
6e7d01
Patchwork-id: 101548
6e7d01
O-Subject: [RHEL-8.5.0 qemu-kvm PATCH 1/3] pc-bios/s390-ccw: fix off-by-one error
6e7d01
Bugzilla: 1942880
6e7d01
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6e7d01
RH-Acked-by: David Hildenbrand <david@redhat.com>
6e7d01
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
6e7d01
6e7d01
This error takes effect when the magic value "zIPL" is located at the
6e7d01
end of a block. For example if s2_cur_blk = 0x7fe18000 and the magic
6e7d01
value "zIPL" is located at 0x7fe18ffc - 0x7fe18fff.
6e7d01
6e7d01
Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
6e7d01
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6e7d01
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
6e7d01
Message-Id: <20200924085926.21709-2-mhartmay@linux.ibm.com>
6e7d01
Reviewed-by: Thomas Huth <thuth@redhat.com>
6e7d01
[thuth: Use "<= ... - 4" instead of "< ... - 3"]
6e7d01
Signed-off-by: Thomas Huth <thuth@redhat.com>
6e7d01
(cherry picked from commit 5f97ba0c74ccace0a4014460de9751ff3c6f454a)
6e7d01
Signed-off-by: Thomas Huth <thuth@redhat.com>
6e7d01
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
6e7d01
---
6e7d01
 pc-bios/s390-ccw/bootmap.c | 2 +-
6e7d01
 1 file changed, 1 insertion(+), 1 deletion(-)
6e7d01
6e7d01
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
6e7d01
index e91ea719ff..bb6e003270 100644
6e7d01
--- a/pc-bios/s390-ccw/bootmap.c
6e7d01
+++ b/pc-bios/s390-ccw/bootmap.c
6e7d01
@@ -163,7 +163,7 @@ static bool find_zipl_boot_menu_banner(int *offset)
6e7d01
     int i;
6e7d01
 
6e7d01
     /* Menu banner starts with "zIPL" */
6e7d01
-    for (i = 0; i < virtio_get_block_size() - 4; i++) {
6e7d01
+    for (i = 0; i <= virtio_get_block_size() - 4; i++) {
6e7d01
         if (magic_match(s2_cur_blk + i, ZIPL_MAGIC_EBCDIC)) {
6e7d01
             *offset = i;
6e7d01
             return true;
6e7d01
-- 
6e7d01
2.27.0
6e7d01