]> Git Repo - qemu.git/commitdiff
scsi-hd: fix property unset case
authorEkaterina Tumanova <[email protected]>
Wed, 4 Mar 2015 10:02:16 +0000 (11:02 +0100)
committerKevin Wolf <[email protected]>
Tue, 10 Mar 2015 13:02:24 +0000 (14:02 +0100)
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 <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Signed-off-by: Ekaterina Tumanova <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
hw/scsi/scsi-disk.c

index 2921728be45a3481e82706b3faa659651086e8c5..54d71f4c036c1bd640d5c361c44a2c7b2dc4e753 100644 (file)
@@ -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) {
This page took 0.027926 seconds and 4 git commands to generate.