usb/msd: add usb_msd_fatal_error() and fix guest-triggerable assert
commit12b69878fc7b4b92b1bbd3959f2c3d4c717881fb
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 30 Aug 2022 06:38:27 +0000 (30 08:38 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 27 Sep 2022 05:32:30 +0000 (27 07:32 +0200)
tree63dc05ce5fb3aba25dffc251980849270a09da7e
parentcea5aa85691d7f26b7ea995417d41a32802691b7
usb/msd: add usb_msd_fatal_error() and fix guest-triggerable assert

Add handler for fatal errors.  Moves device into error state where it
stops responding until the guest resets it.

Guest can send illegal requests where scsi command and usb packet
transfer directions are inconsistent.  Use the new usb_msd_fatal_error()
function instead of assert() in that case.

Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Qiang Liu <cyruscyliu@gmail.com>
Message-Id: <20220830063827.813053-3-kraxel@redhat.com>
hw/usb/dev-storage.c
hw/usb/trace-events
include/hw/usb/msd.h