qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] usb-audio: ignore usb packages with wrong size
Date: Tue, 11 Dec 2018 09:10:35 +0100	[thread overview]
Message-ID: <ef32bf31-f3be-8c14-9d6f-618c47d2b206@redhat.com> (raw)
In-Reply-To: <20181211072649.20700-1-kraxel@redhat.com>

On 12/11/18 8:26 AM, Gerd Hoffmann wrote:
> usb packets with no payload (zero length) seem to happen in practice for
> whatever reason.  Add a check and skip the packet then, otherwise we'll
> trigger an assert.
> 
> Reported-by: Leonardo Soares Müller <leozinho29_eu@hotmail.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/usb/dev-audio.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
> index ee43e4914d..28ac7c5165 100644
> --- a/hw/usb/dev-audio.c
> +++ b/hw/usb/dev-audio.c
> @@ -321,6 +321,9 @@ static int streambuf_put(struct streambuf *buf, USBPacket *p)
>      if (!free) {
>          return 0;
>      }
> +    if (p->iov.size != USBAUDIO_PACKET_SIZE) {
> +        return 0;
> +    }
>      assert(free >= USBAUDIO_PACKET_SIZE);
>      usb_packet_copy(p, buf->data + (buf->prod % buf->size),
>                      USBAUDIO_PACKET_SIZE);
> 

      reply	other threads:[~2018-12-11  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11  7:26 [Qemu-devel] [PATCH] usb-audio: ignore usb packages with wrong size Gerd Hoffmann
2018-12-11  8:10 ` 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=ef32bf31-f3be-8c14-9d6f-618c47d2b206@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).