usb/storage: clear csw on reset
PATCH 1/1 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.
Signed-off-by Gerd Hoffmann <[email protected]>
--- hw/usb/dev-storage.c | 1 + 1 file changed, 1 insertion(+)
hw/usb/dev-storage.c +1 -0
@@ -352,6 +352,7 @@ static void usb_msd_handle_reset(USBDevice *dev)usb_msd_packet_complete (s); } +memset (&s->csw,0 ,sizeof (s->csw)); s->mode =USB_MSDM_CBW ; }
Signature · 1 line
2.29.2
Quoted 16 lines · Gerd Hoffmann
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.Signed-off-by Gerd Hoffmann <[email protected]>--- hw/usb/dev-storage.c | 1 + 1 file changed, 1 insertion(+)hw/usb/dev-storage.c +0
-0
hw/usb/dev-storage.c static void usb_msd_handle_reset(USBDevice *dev) · line 355
Quoted 4 lines
hw/usb/dev-storage.c +1
-0@@ -352,6 +352,7 @@ static void usb_msd_handle_reset(USBDevice *dev)usb_msd_packet_complete (s); } +memset (&s->csw,0 ,sizeof (s->csw));
easy-peasy...
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 2 lines
hw/usb/dev-storage.c +0
-0s->mode =USB_MSDM_CBW ; }