mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
scsi: scsi_bus_legacy_handle_cmdline() can fail, fix callers
None of its callers checks for failure. scsi_hot_add() can crash because of that: (qemu) drive_add 4 if=scsi,format=host_device,file=/dev/sg1 scsi-generic: scsi generic interface too old Segmentation fault (core dumped) Fix all callers, not just scsi_hot_add(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
39508e7adb
commit
fa66b909f3
6 changed files with 16 additions and 8 deletions
|
@ -531,6 +531,9 @@ static int usb_msd_initfn(USBDevice *dev)
|
|||
s->dev.speed = USB_SPEED_FULL;
|
||||
scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);
|
||||
s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0);
|
||||
if (!s->scsi_dev) {
|
||||
return -1;
|
||||
}
|
||||
s->bus.qbus.allow_hotplug = 0;
|
||||
usb_msd_handle_reset(dev);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue