From: Gerd Hoffmann Date: Wed, 21 Aug 2019 08:53:19 +0000 (+0200) Subject: ehci: fix queue->dev null ptr dereference X-Git-Tag: v4.2.0-rc0~217^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1be344b7ad25d572dadeee46d80f0103354352b2;p=thirdparty%2Fqemu.git ehci: fix queue->dev null ptr dereference In case we don't have a device for an active queue, just skip processing the queue (same we do for inactive queues) and log a guest bug. Reported-by: Guenter Roeck Signed-off-by: Gerd Hoffmann Tested-by: Guenter Roeck Message-id: 20190821085319.13711-1-kraxel@redhat.com --- diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 9ca7b87a800..56ab2f457f4 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1838,6 +1838,9 @@ static int ehci_state_fetchqtd(EHCIQueue *q) ehci_set_state(q->ehci, q->async, EST_EXECUTING); break; } + } else if (q->dev == NULL) { + ehci_trace_guest_bug(q->ehci, "no device attached to queue"); + ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); } else { p = ehci_alloc_packet(q); p->qtdaddr = q->qtdaddr;