From: Janne Grunau via B4 Relay <devnull+j.jannau.net@kernel.org>
To: Bin Meng <bmeng.cn@gmail.com>, Marek Vasut <marex@denx.de>,
Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
Joe Hershberger <joe.hershberger@ni.com>
Cc: u-boot@lists.denx.de, asahi@lists.linux.dev,
Janne Grunau <j@jannau.net>, Neal Gompa <neal@gompa.dev>
Subject: [PATCH v4 3/6] usb: xhci: Abort transfers with unallocated rings
Date: Thu, 04 Apr 2024 08:25:51 +0200 [thread overview]
Message-ID: <20240404-asahi-keyboards-v4-3-2266033feaff@jannau.net> (raw)
In-Reply-To: <20240404-asahi-keyboards-v4-0-2266033feaff@jannau.net>
From: Janne Grunau <j@jannau.net>
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 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index b60661fe05..910c5f3352 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
--
2.44.0
next prev parent reply other threads:[~2024-04-04 6:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 6:25 [PATCH v4 0/6] USB keyboard improvements for asahi / desktop systems Janne Grunau via B4 Relay
2024-04-04 6:25 ` [PATCH v4 1/6] usb: xhci: refactor xhci_set_configuration Janne Grunau via B4 Relay
2024-04-04 6:25 ` [PATCH v4 2/6] usb: xhci: Set up endpoints for the first 2 interfaces Janne Grunau via B4 Relay
2024-04-04 6:25 ` Janne Grunau via B4 Relay [this message]
2024-04-04 6:25 ` [PATCH v4 4/6] usb: Add environment based device ignorelist Janne Grunau via B4 Relay
2024-04-04 6:25 ` [PATCH v4 5/6] usb: kbd: support Apple Magic Keyboards (2021) Janne Grunau via B4 Relay
2024-04-04 6:25 ` [PATCH v4 6/6] usb: kbd: Add probe quirk for Apple and Keychron keyboards Janne Grunau via B4 Relay
2024-04-05 14:52 ` [PATCH v4 0/6] USB keyboard improvements for asahi / desktop systems Marek Vasut
2024-04-05 19:05 ` Janne Grunau
2024-04-06 18:52 ` Marek Vasut
2024-04-06 20:04 ` Janne Grunau
2024-04-07 1:05 ` Marek Vasut
2024-04-08 7:46 ` Janne Grunau
2024-04-12 12:53 ` Marek Vasut
2024-04-12 18:26 ` Marek Vasut
2024-04-12 18:37 ` Tom Rini
2024-04-13 0:59 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240404-asahi-keyboards-v4-3-2266033feaff@jannau.net \
--to=devnull+j.jannau.net@kernel.org \
--cc=asahi@lists.linux.dev \
--cc=bmeng.cn@gmail.com \
--cc=j@jannau.net \
--cc=joe.hershberger@ni.com \
--cc=marex@denx.de \
--cc=neal@gompa.dev \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).