diff options
author | Janne Grunau <j@jannau.net> | 2024-04-04 08:25:51 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2024-04-05 03:25:14 +0200 |
commit | 0b6775c40283dd645a28b30cafa9d8cc19dc34aa (patch) | |
tree | cb6fdb13b3b2f9fdc0b4c3b980bba3a6c983a0fe | |
parent | 086e461d9e2cc0b98a187883774fa4b8be68a0ab (diff) |
usb: xhci: Abort transfers with unallocated rings
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>
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index b60661fe05e..910c5f3352b 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -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 |