From: Elkin Cruz <elkin@google.com>
To: Hans de Goede <hansg@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Antti Laakso <antti.laakso@linux.intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, irogers@google.com,
Elkin Cruz <elkin@google.com>,
stable@vger.kernel.org
Subject: [PATCH 1/2] usb: misc: usbio: stop resubmitting bulk IN URB on fatal status
Date: Wed, 25 Nov 2026 22:28:27 +0000 [thread overview]
Message-ID: <20261125222828.1452483-2-elkin@google.com> (raw)
In-Reply-To: <20261125222828.1452483-1-elkin@google.com>
usbio_bulk_recv() unconditionally resubmits usbio->urb in softirq
completion context regardless of urb->status. When the bulk IN endpoint
encounters a terminal status such as -EPIPE, -ESHUTDOWN, -ENODEV,
-ECONNRESET, or -ENOENT (for example on endpoint stall, disconnect, or
usb_kill_urb()), resubmitting the URB causes either a tight softirq
resubmission loop on persistent errors or a wasted submission against a
terminating URB, and zero-length completions also inspect stale
bpkt->header.flags bytes.
Return without resubmitting on -ENOENT, -ECONNRESET, -ENODEV, -ESHUTDOWN,
and -EPIPE (matching usb-ljca), verify urb->actual_length covers the
packet header before checking USBIO_PKTFLAG_RSP, and log unexpected
usb_submit_urb() errors.
Fixes: 121a0f839dbb ("usb: misc: Add Intel USBIO bridge driver")
Cc: stable@vger.kernel.org
Signed-off-by: Elkin Cruz <elkin@google.com>
---
drivers/usb/misc/usbio.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/misc/usbio.c b/drivers/usb/misc/usbio.c
index 7b5f8669aee3..6142a32c18a9 100644
--- a/drivers/usb/misc/usbio.c
+++ b/drivers/usb/misc/usbio.c
@@ -239,17 +239,31 @@ static void usbio_bulk_recv(struct urb *urb)
{
struct usbio_bulk_packet *bpkt = urb->transfer_buffer;
struct usbio_device *usbio = urb->context;
+ int ret;
- if (!urb->status) {
- if (bpkt->header.flags & USBIO_PKTFLAG_RSP) {
+ switch (urb->status) {
+ case 0:
+ if (urb->actual_length >= sizeof(bpkt->header) &&
+ (bpkt->header.flags & USBIO_PKTFLAG_RSP)) {
usbio->rxdat_len = urb->actual_length;
complete(&usbio->done);
}
- } else if (urb->status != -ENOENT) {
+ break;
+ case -ENOENT:
+ case -ECONNRESET:
+ case -ENODEV:
+ case -ESHUTDOWN:
+ case -EPIPE:
+ dev_dbg(usbio->dev, "Bulk in urb terminated: %d\n", urb->status);
+ return;
+ default:
dev_err(usbio->dev, "Bulk in error %d\n", urb->status);
+ break;
}
- usb_submit_urb(usbio->urb, GFP_ATOMIC);
+ ret = usb_submit_urb(usbio->urb, GFP_ATOMIC);
+ if (ret && ret != -EPERM)
+ dev_err(usbio->dev, "Submit bulk in urb error %d\n", ret);
}
int usbio_bulk_msg(struct auxiliary_device *adev, u8 type, u8 cmd, bool last,
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-25 22:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 22:28 [PATCH 0/2] usb: misc: usbio: fix fatal URB resubmission and probe maxpacket bounds Elkin Cruz
2026-11-25 22:28 ` Elkin Cruz [this message]
2026-11-25 22:28 ` [PATCH 2/2] usb: misc: usbio: validate endpoint maxpacket sizes in usbio_probe() Elkin Cruz
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=20261125222828.1452483-2-elkin@google.com \
--to=elkin@google.com \
--cc=antti.laakso@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®