Skip to contentSkip to conversation

scsi-hd: fix property unset case

PATCH In review Ekaterina Tumanova 3 participants 5 messages Mar 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi-hd: fix property unset case

commit "BlockConf: Call backend functions to detect geometry and blocksizes" causes a segmentation fault on the invalid configuration of a scsi device without a drive.

Lets check for conf.blk before calling blkconf_blocksizes. The error will be handled later on in scsi_realize anyway.

---
 hw/scsi/scsi-disk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/scsi/scsi-disk.c +6 -1
index 2921728..54d71f4 100644
@@ -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) {
Signature · 1 line
2.1.4
#1 lore raw

Am 04.03.2015 um 11:02 hat Ekaterina Tumanova geschrieben:

Quoted 11 lines

commit "BlockConf: Call backend functions to detect geometry and blocksizes" causes a segmentation fault on the invalid configuration of a scsi device without a drive.

Lets check for conf.blk before calling blkconf_blocksizes. The error will be handled later on in scsi_realize anyway.

Thanks, added the commit ID of the regression to the commit message, and applied to the block branch.

Kevin

#2 lore raw
Quoted 8 lines · Kevin Wolf

Am 04.03.2015 um 11:02 hat Ekaterina Tumanova geschrieben:

Quoted 7 lines

commit "BlockConf: Call backend functions to detect geometry and blocksizes" causes a segmentation fault on the invalid configuration of a scsi device without a drive.

Lets check for conf.blk before calling blkconf_blocksizes. The error will be handled later on in scsi_realize anyway.

Quoted 6 lines
Quoted 4 lines

Thanks, added the commit ID of the regression to the commit message, and applied to the block branch.

But that commit is not yet upstream, so the ID won't be stable. Are you planning to change it once it's merged?

Max

#3 lore raw

Am 04.03.2015 um 14:58 hat Max Reitz geschrieben:

Quoted 13 lines · Kevin Wolf
Quoted 12 lines

Am 04.03.2015 um 11:02 hat Ekaterina Tumanova geschrieben:

Quoted 11 lines

commit "BlockConf: Call backend functions to detect geometry and blocksizes" causes a segmentation fault on the invalid configuration of a scsi device without a drive.

Lets check for conf.blk before calling blkconf_blocksizes. The error will be handled later on in scsi_realize anyway.

Quoted 5 lines
Quoted 2 lines

Thanks, added the commit ID of the regression to the commit message, and applied to the block branch.

But that commit is not yet upstream, so the ID won't be stable. Are you planning to change it once it's merged?

Unless someone touches the pull request (which he shouldn't), the commit ID is going to stay.

Kevin

#4 lore raw
Quoted 14 lines · Kevin Wolf

Am 04.03.2015 um 14:58 hat Max Reitz geschrieben:

Quoted 13 lines · Kevin Wolf
Quoted 12 lines

Am 04.03.2015 um 11:02 hat Ekaterina Tumanova geschrieben:

Quoted 11 lines

commit "BlockConf: Call backend functions to detect geometry and blocksizes" causes a segmentation fault on the invalid configuration of a scsi device without a drive.

Lets check for conf.blk before calling blkconf_blocksizes. The error will be handled later on in scsi_realize anyway.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Thanks, added the commit ID of the regression to the commit message, and applied to the block branch.

But that commit is not yet upstream, so the ID won't be stable. Are you planning to change it once it's merged?

Unless someone touches the pull request (which he shouldn't), the commit ID is going to stay.

Oh, that's nice, I didn't know that. Thanks for explaining.

Max