]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: xhci: Abort transfers with unallocated rings
authorJanne Grunau <j@jannau.net>
Thu, 4 Apr 2024 06:25:51 +0000 (08:25 +0200)
committerMarek Vasut <marex@denx.de>
Fri, 5 Apr 2024 01:25:14 +0000 (03:25 +0200)
Discovered while trying to use the second interface in the USB keyboard
driver necessary on Apple USB keyboards.

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
drivers/usb/host/xhci-ring.c

index b60661fe05e7317978dfb757cbd292658f781c0a..910c5f3352b805e1895f974aa6f23d8c7c7093e1 100644 (file)
@@ -685,6 +685,9 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
                reset_ep(udev, ep_index);
 
        ring = virt_dev->eps[ep_index].ring;
+       if (!ring)
+               return -EINVAL;
+
        /*
         * How much data is (potentially) left before the 64KB boundary?
         * XHCI Spec puts restriction( TABLE 49 and 6.4.1 section of XHCI Spec)
@@ -871,6 +874,8 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
        ep_index = usb_pipe_ep_index(pipe);
 
        ep_ring = virt_dev->eps[ep_index].ring;
+       if (!ep_ring)
+               return -EINVAL;
 
        /*
         * Check to see if the max packet size for the default control