All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] usb/storage: clear csw on reset
Date: Fri, 12 Mar 2021 11:01:10 +0100	[thread overview]
Message-ID: <120ee673-b1e8-44ea-eb7a-e98d017a3aec@redhat.com> (raw)
In-Reply-To: <20210312094954.796799-1-kraxel@redhat.com>

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;
>  }



      reply	other threads:[~2021-03-12 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  9:49 [PATCH] usb/storage: clear csw on reset Gerd Hoffmann
2021-03-12 10:01 ` Philippe Mathieu-Daudé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120ee673-b1e8-44ea-eb7a-e98d017a3aec@redhat.com \
    --to=philmd@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.