[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] usb/storage: clear csw on reset
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] usb/storage: clear csw on reset |
Date: |
Fri, 12 Mar 2021 11:01:10 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 |
On 3/12/21 10:49 AM, Gerd Hoffmann wrote:
> 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>
> ---
> hw/usb/dev-storage.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> index a5f76fc00120..fd4ea818115c 100644
> --- a/hw/usb/dev-storage.c
> +++ b/hw/usb/dev-storage.c
> @@ -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é <philmd@redhat.com>
> s->mode = USB_MSDM_CBW;
> }