CVE-2026-139007: usb: fotg210: validate endpoint index in ep0 handlers
In the Linux kernel, the following vulnerability has been resolved:
usb: fotg210: validate endpoint index in ep0 handlers
fotg210setfeature(), fotg210clearfeature() and fotg210getstatus() use wIndex from the USB setup packet to index the fotg210->ep[] array without verifying that the endpoint number falls below FOTG210MAXNUMEP (5). USBENDPOINTNUMBERMASK is 0x0f, so a malicious host can issue a setup packet with wIndex 5..15, resulting in an out-of-bounds array read. The resulting wild pointer is then dereferenced in fotg210setepnstall() or fotg210isepnstall(), which compute an MMIO register offset from ep->epnum and perform iowrite32 through it.
fotg210clearfeature() is especially problematic: the out-of-bounds access occurs at function entry (source-level) regardless of which USBRECIP case is taken, because the ep pointer is computed before the switch statement.
Add upper-bound checks on the endpoint number derived from wIndex in all three functions. Invalid endpoint numbers in clearfeature now trigger fotg210requesterror() (STALL) instead of silently falling through to fotg210setcxdone(). Also add the missing le16tocpu() conversion for ctrl->wIndex in fotg210getstatus() to fix a sparse endianness warning.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In the Linux kernel FOTG210 USB driver, validate the endpoint number derived from wIndex in fotg210_set_feature(), fotg210_clear_feature(), and fotg210_get_status() before indexing fotg210->ep[]; require it to be below FOTG210_MAX_NUM_EP (5), and call fotg210_request_error() (STALL) for invalid endpoint numbers.
- Compensating control
In fotg210_get_status(), convert ctrl->wIndex with le16_to_cpu() before using it.