Re: [PATCH] usb: xhci: reject bulk transfers beyond mapped scatterlists

From: Michal Pecio

Date: Tue Dec 01 2026 - 16:45:35 EST


On Tue, 1 Dec 2026 15:24:40 -0500, Artem Dinaburg wrote:
> A bulk or interrupt URB can request more bytes than its mapped
> scatterlist covers. count_sg_trbs_needed() counts only the mapped
> entries, but xhci_queue_bulk_tx() queues TRBs until the requested length
> is reached. After the final entry it continues from the last DMA address
> and length, so the controller transfers data outside the mapping.
>
> A USB device can cause this mismatch.

Which one and how exactly?

That's a driver bug, albeit one which could conceivably
be triggered by a nonconforming device.

Regards,
Michal