]> Git Repo - qemu.git/commit - hw/scsi/scsi-bus.c
scsi: Fix scsi_bus_legacy_add_drive() scsi-generic with serial
authorMarkus Armbruster <[email protected]>
Fri, 23 Aug 2013 16:01:58 +0000 (18:01 +0200)
committerPaolo Bonzini <[email protected]>
Thu, 12 Sep 2013 06:46:21 +0000 (08:46 +0200)
commitc24e7517ee4a98e90eee5f0f07708a1fa12326b3
tree80376ecd9fa2a5d5001eadb767f4c0c6cc732a7e
parenta27292b5d7545509bfa171922516d2033c570205
scsi: Fix scsi_bus_legacy_add_drive() scsi-generic with serial

scsi_bus_legacy_add_drive() creates either a scsi-disk or a
scsi-generic device.  It sets property "serial" to argument serial
unless null.  Crashes with scsi-generic, because it doesn't have such
the property.

Only usb_msd_initfn_storage() passes non-null serial.  Reproducer:

    $ qemu-system-x86_64 -nodefaults -display none -S -usb \
    -drive if=none,file=/dev/sg1,id=usb-drv0 \
    -device usb-storage,id=usb-msd0,drive=usb-drv0,serial=123
    qemu-system-x86_64: -device usb-storage,id=usb-msd0,drive=usb-drv0,serial=123: Property '.serial' not found
    Aborted (core dumped)

Fix by handling exactly like "removable": set the property only when
it exists.

Cc: [email protected]
Reviewed-by: Andreas Färber <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/scsi/scsi-bus.c
This page took 0.026224 seconds and 4 git commands to generate.