[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 67/73] scsi-hd: fix property unset case
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 67/73] scsi-hd: fix property unset case |
Date: |
Mon, 9 Mar 2015 16:41:52 +0100 |
From: Ekaterina Tumanova <address@hidden>
Commit c53659f0 ("BlockConf: Call backend functions to detect geometry
and blocksizes") causes a segmentation fault on the invalid
configuration of a scsi device without a drive.
Let's check for conf.blk before calling blkconf_blocksizes. The error
will be handled later on in scsi_realize anyway.
Reported-by: Max Reitz <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Ekaterina Tumanova <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/scsi/scsi-disk.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 2921728..54d71f4 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2291,7 +2291,12 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
- blkconf_blocksizes(&s->qdev.conf);
+ /* can happen for devices without drive. The error message for missing
+ * backend will be issued in scsi_realize
+ */
+ if (s->qdev.conf.blk) {
+ blkconf_blocksizes(&s->qdev.conf);
+ }
s->qdev.blocksize = s->qdev.conf.logical_block_size;
s->qdev.type = TYPE_DISK;
if (!s->product) {
--
1.8.3.1
- [Qemu-block] [PULL 00/73] Block patches, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 65/73] iotests: Drop vpc from 004's and 104's format list, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 62/73] virtio-blk: Remove the stale FIXME comment, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 66/73] block/vdi: Add locking for parallel requests, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 70/73] MAINTAINERS: Add jsnow as IDE maintainer, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 64/73] iotests: Remove 006, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 71/73] block/raw-posix: fix launching with failed disks, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 22/73] qcow2: Helper function for refcount modification, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 63/73] iotests: Fix 051's reference output, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 67/73] scsi-hd: fix property unset case,
Kevin Wolf <=
- [Qemu-block] [PULL 72/73] iotests: add O_DIRECT alignment probing test, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 68/73] Add testcase for scsi-hd devices without drive property, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 73/73] MAINTAINERS: Add jcody as blockjobs, block devices maintainer, Kevin Wolf, 2015/03/09
- [Qemu-block] [PULL 69/73] sheepdog: Fix misleading error messages in sd_snapshot_create(), Kevin Wolf, 2015/03/09
- Re: [Qemu-block] [Qemu-devel] [PULL 00/73] Block patches, Peter Maydell, 2015/03/10