* [Qemu-devel] [PATCH] usb-audio: ignore usb packages with wrong size
@ 2018-12-11 7:26 Gerd Hoffmann
2018-12-11 8:10 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2018-12-11 7:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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>
---
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);
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-audio: ignore usb packages with wrong size
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é
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-12-11 8:10 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel
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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-11 8:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).