aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-03-12 10:49:54 +0100
committerGerd Hoffmann <kraxel@redhat.com>2021-03-15 17:01:17 +0100
commit39912c14da07a2dbc73854addcfa0a42596340ac (patch)
treef17e9bd2ce81f8ae88b9ddd77cdabd1e0ced49d0
parentf98c9bd45fb4f479ca38f8a2b2abcf27e9c2b9aa (diff)
downloadqemu-39912c14da07a2dbc73854addcfa0a42596340ac.zip
qemu-39912c14da07a2dbc73854addcfa0a42596340ac.tar.gz
qemu-39912c14da07a2dbc73854addcfa0a42596340ac.tar.bz2
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>
-rw-r--r--hw/usb/dev-storage.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 7b587ad..dca62d5 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -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;
}