CVE-2026-64339: usb: misc: usbio: bound bulk IN response length to the received transfer
In the Linux kernel, the following vulnerability has been resolved:
usb: misc: usbio: bound bulk IN response length to the received transfer
usbiobulkmsg() copies bpktlen = le16tocpu(bpkt->len) bytes out of the bulk IN buffer (usbio->rxbuf, allocated with size usbio->rxbuflen) into the caller's buffer. bpktlen is fully controlled by the device and is only checked against ibuflen; ibuflen in turn is checked against usbio->txbuflen, not against rxbuflen:
if ((obuflen > (usbio->txbuflen - sizeof(bpkt))) || (ibuflen > (usbio->txbuflen - sizeof(bpkt)))) return -EMSGSIZE;
txbuflen and rxbuflen are taken independently from the bulk OUT and bulk IN endpoint wMaxPacketSize in usbioprobe(). A malicious or malfunctioning device that advertises a large bulk OUT endpoint and a small bulk IN endpoint (e.g. by claiming one of the quirk-free IDs such as the Lattice NX33U, 0x2ac1:0x20cb) therefore makes ibuflen, and hence the device-supplied bpktlen, exceed rxbuflen. memcpy() then reads up to txbuflen - rxbuflen bytes past the end of the rxbuf slab object. The over-read bytes are handed back to the i2c layer and on to user space through i2c-dev, disclosing adjacent slab memory; with KASAN this is reported as a slab-out-of-bounds read.
The number of bytes actually received is already known: act equals the URB actuallength and is bounded by rxbuflen. Reject any response that claims more payload than was received, mirroring the existing "act < sizeof(bpkt)" check just above.
The control path (usbioctrlmsg()) is not affected: it uses a single buffer (ctrlbuf) for both directions, so its analogous copy can never leave the allocation.
Found by code review. The out-of-bounds read was confirmed under AddressSanitizer with a faithful userspace model of usbiobulkmsg()'s receive path (an rxbuflen-sized buffer, the same act/ibuflen/bpktlen checks and the memcpy). A USB raw-gadget + dummyhcd reproducer is also available.