* [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level
@ 2026-11-23 18:26 Alex Kononov via B4 Relay
2026-11-23 18:31 ` sashiko-bot
2026-11-23 19:56 ` Michal Pecio
0 siblings, 2 replies; 5+ messages in thread
From: Alex Kononov via B4 Relay @ 2026-11-23 18:26 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Michal Pecio, Alex Kononov
From: Alex Kononov <alex@albefly.com>
An isochronous Buffer Overrun event means the device sent more
data than the TD could hold.
This is triggered by the device, not by a driver bug, and the
error is already reported to the class driver as
-EOVERFLOW in iso_frame_desc[].status.
Logging it with xhci_warn() can flood the kernel log.
A USB S/PDIF adapter (262a:9123) whose S/PDIF input loses its
signal produces this event on nearly every microframe,
about 7,200 messages per second, keeping systemd-journald
busy at 100% of a CPU.
Use xhci_dbg() like the other device-triggerable completion codes.
Suggested-by: Michal Pecio <michal.pecio@gmail.com>
Signed-off-by: Alex Kononov <alex@albefly.com>
---
As suggested by Michal and agreed by Mathias in the discussion:
https://lore.kernel.org/linux-usb/2ffafaa3-bdea-4d67-b224-2f18d76134be@linux.intel.com/T/
COMP_BANDWIDTH_OVERRUN_ERROR is arguably device-triggerable as well and
has been reported to flood logs (https://bugs.debian.org/1035939);
I left it alone here. Happy to send a separate patch if you think
it should get the same treatment.
---
drivers/usb/host/xhci-ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index a1fa188680f5867e151c32ab94e2218cd6e26864..39d214e8a0289ec0b86e75833a566c2b7a91adb8 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2815,7 +2815,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
slot_id, ep_index);
break;
case COMP_ISOCH_BUFFER_OVERRUN:
- xhci_warn(xhci,
+ xhci_dbg(xhci,
"WARN: buffer overrun event for slot %u ep %u on endpoint",
slot_id, ep_index);
break;
---
base-commit: 8e31dedb9ad496ea7dd7064d77d6f7d459c1c90f
change-id: 20261123-xhci-overrun-dbg-e9d333d1ed42
Best regards,
--
Alex Kononov <alex@albefly.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level
2026-11-23 18:26 [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level Alex Kononov via B4 Relay
@ 2026-11-23 18:31 ` sashiko-bot
2026-11-25 17:59 ` Mathias Nyman
2026-11-23 19:56 ` Michal Pecio
1 sibling, 1 reply; 5+ messages in thread
From: sashiko-bot @ 2026-11-23 18:31 UTC (permalink / raw)
To: Alex Kononov; +Cc: linux-usb
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] usb: xhci: use-after-free in handle_tx_event() [1]
--
commit a6e2659078b35c8ca15718bbecaa3c3d7eb80931
Author: Alex Kononov <alex@albefly.com>
usb: xhci: Demote isoch buffer overrun message to debug level
This commit changes the logging of COMP_ISOCH_BUFFER_OVERRUN events in
handle_tx_event() from xhci_warn() to xhci_dbg() to avoid flooding the
kernel log on device-triggered overruns.
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index a1fa188680f58..39d214e8a0289 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -2815,7 +2815,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
> slot_id, ep_index);
> break;
> case COMP_ISOCH_BUFFER_OVERRUN:
> - xhci_warn(xhci,
> + xhci_dbg(xhci,
> "WARN: buffer overrun event for slot %u ep %u on endpoint",
> slot_id, ep_index);
> break;
[Severity: Critical]
This problem wasn't introduced by this patch, but can handle_tx_event()
pass a freed td pointer to xhci_handle_halted_endpoint() [1]?
Later in handle_tx_event(), when td->error_mid_td is set and the event TRB
lies outside that TD, xhci_dequeue_td() -> xhci_td_cleanup() gives back
the URB and frees the urb_priv containing td:
drivers/usb/host/xhci-ring.c:handle_tx_event() {
...
td = list_first_entry_or_null(&ep_ring->td_list, struct xhci_td, td_list);
if (td && td->error_mid_td && !trb_in_td(td, ep_trb_dma)) {
xhci_dbg(xhci, "Missing TD completion event after mid TD error\n");
xhci_dequeue_td(xhci, td, ep_ring, td->status);
}
if (list_empty(&ep_ring->td_list)) {
...
ep->skip = false;
goto check_endpoint_halted;
}
...
check_endpoint_halted:
if (xhci_halted_host_endpoint(xhci, ep_ctx, trb_comp_code))
xhci_handle_halted_endpoint(xhci, ep, td, EP_HARD_RESET);
}
If that TD was the last one on ep_ring->td_list and the endpoint halted,
the jump to check_endpoint_halted passes the dangling td pointer to
xhci_handle_halted_endpoint(), which links td->cancelled_td_list into
ep->cancelled_td_list, causing a use-after-free and list corruption.
Setting td = NULL after xhci_dequeue_td() would avoid this.
[1] https://sashiko.dev/#/bug/linux-2b321b4d-f99f-4acd-9590-8dd98a82ebb5
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-xhci-overrun-dbg-v1-1-4e5a2f11740d@albefly.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level
2026-11-23 18:31 ` sashiko-bot
@ 2026-11-25 17:59 ` Mathias Nyman
2026-11-27 10:02 ` Michal Pecio
0 siblings, 1 reply; 5+ messages in thread
From: Mathias Nyman @ 2026-11-25 17:59 UTC (permalink / raw)
To: linux-usb
On 11/23/26 20:31, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found no new issues
> in this patch, but noticed 1 related pre-existing issue it does not
> introduce:
> - [Critical] usb: xhci: use-after-free in handle_tx_event() [1]
> --
>
> commit a6e2659078b35c8ca15718bbecaa3c3d7eb80931
> Author: Alex Kononov <alex@albefly.com>
>
> usb: xhci: Demote isoch buffer overrun message to debug level
>
> This commit changes the logging of COMP_ISOCH_BUFFER_OVERRUN events in
> handle_tx_event() from xhci_warn() to xhci_dbg() to avoid flooding the
> kernel log on device-triggered overruns.
>
>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>> index a1fa188680f58..39d214e8a0289 100644
>> --- a/drivers/usb/host/xhci-ring.c
>> +++ b/drivers/usb/host/xhci-ring.c
>> @@ -2815,7 +2815,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
>> slot_id, ep_index);
>> break;
>> case COMP_ISOCH_BUFFER_OVERRUN:
>> - xhci_warn(xhci,
>> + xhci_dbg(xhci,
>> "WARN: buffer overrun event for slot %u ep %u on endpoint",
>> slot_id, ep_index);
>> break;
>
> [Severity: Critical]
> This problem wasn't introduced by this patch, but can handle_tx_event()
> pass a freed td pointer to xhci_handle_halted_endpoint() [1]?
Adding the patch, and writing a separate fix for this sashiko reported issue.
Thanks
Mathias
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level
2026-11-25 17:59 ` Mathias Nyman
@ 2026-11-27 10:02 ` Michal Pecio
0 siblings, 0 replies; 5+ messages in thread
From: Michal Pecio @ 2026-11-27 10:02 UTC (permalink / raw)
To: Mathias Nyman; +Cc: linux-usb
On Wed, 25 Nov 2026 19:59:41 +0200, Mathias Nyman wrote:
> On 11/23/26 20:31, sashiko-bot@kernel.org wrote:
> > [Severity: Critical]
> > This problem wasn't introduced by this patch, but can handle_tx_event()
> > pass a freed td pointer to xhci_handle_halted_endpoint() [1]?
>
> Adding the patch, and writing a separate fix for this sashiko reported issue.
Hi Mathias,
Severity is vastly overstated. For xhci_halted_host_endpoint() to
return true, we need either a Babble/Transaction/Split Error on an
endpoint whose output context indicates non-isochronous (while being
isochronous and using error_mid_td), or Stall Error on isochronous.
Either case is a severe hardware bug.
Simultaneously, we need another HW bug which generates such events
on an empty ring, or a SW bug which gives back TDs before execution.
I think these cases of unlinking from a still-running endpoint have
mostly been eliminated by now and we don't need to worry about events
on empty rings very much anymore.
That being said, clearing 'td' after error mid TD handling or using
a different temporary variable there would make the code more robust
against potential "oopsies" of this sort, so that makes sense.
Regards,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level
2026-11-23 18:26 [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level Alex Kononov via B4 Relay
2026-11-23 18:31 ` sashiko-bot
@ 2026-11-23 19:56 ` Michal Pecio
1 sibling, 0 replies; 5+ messages in thread
From: Michal Pecio @ 2026-11-23 19:56 UTC (permalink / raw)
To: Alex Kononov via B4 Relay
Cc: alex, Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel
On Mon, 23 Nov 2026 13:26:32 -0500, Alex Kononov via B4 Relay wrote:
> From: Alex Kononov <alex@albefly.com>
>
> An isochronous Buffer Overrun event means the device sent more
> data than the TD could hold.
> This is triggered by the device, not by a driver bug, and the
> error is already reported to the class driver as
> -EOVERFLOW in iso_frame_desc[].status.
>
> Logging it with xhci_warn() can flood the kernel log.
> A USB S/PDIF adapter (262a:9123) whose S/PDIF input loses its
> signal produces this event on nearly every microframe,
> about 7,200 messages per second, keeping systemd-journald
> busy at 100% of a CPU.
>
> Use xhci_dbg() like the other device-triggerable completion codes.
>
> Suggested-by: Michal Pecio <michal.pecio@gmail.com>
> Signed-off-by: Alex Kononov <alex@albefly.com>
> ---
> As suggested by Michal and agreed by Mathias in the discussion:
> https://lore.kernel.org/linux-usb/2ffafaa3-bdea-4d67-b224-2f18d76134be@linux.intel.com/T/
>
> COMP_BANDWIDTH_OVERRUN_ERROR is arguably device-triggerable as well and
> has been reported to flood logs (https://bugs.debian.org/1035939);
> I left it alone here. Happy to send a separate patch if you think
> it should get the same treatment.
That's not device triggerable, it means URB size exceeded bandwidth
allocation. Such URBs shouldn't pass validation by usb_submit_urb().
Only a buggy host controller can produce this warning without any
fault of the kernel.
My Etron does, when multi-TRB isochronous TDs are used. Apparently
it doesn't support those, maybe it needs some ludicrous out-of-spec
workaround. Sadly, patching qemu-xhci to pretend being Etron makes
Windows bluescreen at boot, so IDK how / if Windows deals with the
numerous bugs in those chips.
If somebody sees this warning on current kernel releases with spec-
compliant xHCI controllers, we would be curious to hear about it.
Regards,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-27 10:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 18:26 [PATCH] usb: xhci: Demote isoch buffer overrun message to debug level Alex Kononov via B4 Relay
2026-11-23 18:31 ` sashiko-bot
2026-11-25 17:59 ` Mathias Nyman
2026-11-27 10:02 ` Michal Pecio
2026-11-23 19:56 ` Michal Pecio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox