usb/storage: clear csw on reset

Stale data in csw (specifically residue) can confuse the state machine
and allows the guest trigger an assert().  So clear csw on reset to
avoid this happening in case the guest resets the device in the middle
of a request.

Buglink: https://bugs.launchpad.net/qemu/+bug/1523811
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210312094954.796799-1-kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2021-03-12 10:49:54 +01:00
parent f98c9bd45f
commit 39912c14da
1 changed files with 1 additions and 0 deletions

View File

@ -313,6 +313,7 @@ void usb_msd_handle_reset(USBDevice *dev)
usb_msd_packet_complete(s);
}
memset(&s->csw, 0, sizeof(s->csw));
s->mode = USB_MSDM_CBW;
}