From: Gerd Hoffmann Date: Tue, 11 Dec 2018 07:26:49 +0000 (+0100) Subject: usb-audio: ignore usb packages with wrong size X-Git-Tag: qemu-xen-4.13.0-rc1~454^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a7fde1c1706a93c304eb301cc290d71c9426493b;p=qemu-xen.git usb-audio: ignore usb packages with wrong size 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 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Message-id: 20181211072649.20700-1-kraxel@redhat.com --- 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);