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