]> git.proxmox.com Git - mirror_qemu.git/commitdiff
xhci: check device is not NULL before calling usb_ep_get()
authorLiam Merwick <liam.merwick@oracle.com>
Wed, 6 Feb 2019 13:36:50 +0000 (13:36 +0000)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 20 Feb 2019 08:41:23 +0000 (09:41 +0100)
Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-id: 1549460216-25808-4-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-xhci.c

index 99b83aaa9ed5ca0cacbeb5aeccd56a5a5df1a3f6..ec28bee319637e1b7948c426e2687ec186bf88b2 100644 (file)
@@ -3276,10 +3276,10 @@ static USBEndpoint *xhci_epid_to_usbep(XHCIEPContext *epctx)
         return NULL;
     }
     uport = epctx->xhci->slots[epctx->slotid - 1].uport;
-    token = (epctx->epid & 1) ? USB_TOKEN_IN : USB_TOKEN_OUT;
-    if (!uport) {
+    if (!uport || !uport->dev) {
         return NULL;
     }
+    token = (epctx->epid & 1) ? USB_TOKEN_IN : USB_TOKEN_OUT;
     return usb_ep_get(uport->dev, token, epctx->epid >> 1);
 }