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>
This commit is contained in:
Gerd Hoffmann 2022-08-30 08:38:27 +02:00
parent cea5aa8569
commit 12b69878fc
3 changed files with 31 additions and 1 deletions

View file

@ -40,6 +40,7 @@ struct MSDState {
bool removable;
bool commandlog;
SCSIDevice *scsi_dev;
bool needs_reset;
};
typedef struct MSDState MSDState;