Blame SOURCES/seabios-blockcmd-accept-only-disks-and-CD-ROMs.patch

3abf7a
From a40b8bfb775945aa62510f0a3f4a3301aa3d65fc Mon Sep 17 00:00:00 2001
3abf7a
From: Paolo Bonzini <pbonzini@redhat.com>
3abf7a
Date: Tue, 9 May 2017 11:24:34 +0200
3abf7a
Subject: [PATCH 1/4] blockcmd: accept only disks and CD-ROMs
3abf7a
3abf7a
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
3abf7a
Message-id: <20170509112437.30666-2-pbonzini@redhat.com>
3abf7a
Patchwork-id: 75050
3abf7a
O-Subject: [RHEL7.4 seabios PATCH 1/4] blockcmd: accept only disks and CD-ROMs
3abf7a
Bugzilla: 1020622
3abf7a
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
3abf7a
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
3abf7a
RH-Acked-by: Fam Zheng <famz@redhat.com>
3abf7a
3abf7a
From: Roman Kagan <rkagan@virtuozzo.com>
3abf7a
3abf7a
Luns that report to INQUIRY with a type other than CD-ROM are considered
3abf7a
disks.  This isn't necessarily the case; working with such luns as disks
3abf7a
may lead to unpredictable results.
3abf7a
3abf7a
So bail out if the lun is neither CD-ROM nor disk.
3abf7a
3abf7a
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
3abf7a
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3abf7a
(cherry picked from commit 177aecfcf4161c53f503782e68608284b198c0f9)
3abf7a
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
3abf7a
---
3abf7a
 src/hw/blockcmd.c | 3 +++
3abf7a
 1 file changed, 3 insertions(+)
3abf7a
3abf7a
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
3abf7a
index f147100..5ad128e 100644
3abf7a
--- a/src/hw/blockcmd.c
3abf7a
+++ b/src/hw/blockcmd.c
3abf7a
@@ -217,6 +217,9 @@ scsi_drive_setup(struct drive_s *drive, const char *s, int prio)
3abf7a
         return 0;
3abf7a
     }
3abf7a
 
3abf7a
+    if (pdt != SCSI_TYPE_DISK)
3abf7a
+        return -1;
3abf7a
+
3abf7a
     ret = scsi_is_ready(&dop);
3abf7a
     if (ret) {
3abf7a
         dprintf(1, "scsi_is_ready returned %d\n", ret);
3abf7a
-- 
3abf7a
1.8.3.1
3abf7a