xhci: fix guest-triggerable assert
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 2 Jul 2018 16:27:52 +0000 (18:27 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 3 Jul 2018 07:50:39 +0000 (09:50 +0200)
Set xhci into error state instead of throwing a core dump.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180702162752.29233-1-kraxel@redhat.com

hw/usb/hcd-xhci.c

index 721beb5486e50ad6bad88d77484344fa92d74081..8f1a01a40557e8b60285789d840c4431f0c685be 100644 (file)
@@ -1954,7 +1954,12 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
         for (i = 0; i < length; i++) {
             TRBType type;
             type = xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL);
-            assert(type);
+            if (!type) {
+                xhci_die(xhci);
+                xhci_ep_free_xfer(xfer);
+                epctx->kick_active--;
+                return;
+            }
         }
         xfer->streamid = streamid;