In the Linux kernel, the following vulnerability has been resolved: net: usb: pegasus: check rx pkt_len against the received length read_bulk_callback() takes the frame length from the device, from the receive header on the 0x8513 and from the trailing status bytes on the other chips, and only checks it against PEGASUS_MTU before passing that many bytes up the stack. In two cases the stack then uses bytes that the device did not send: - A device that sends a short transfer but claims a long frame gets the stale or uninitialized remainder of the receive skb delivered as packet data. - A device that claims a frame shorter than an Ethernet header gets past the check as well. eth_type_trans() takes pkt_type from h_dest and the protocol from h_proto without checking skb->len. If the transfer is also short, those come from bytes left in the skb by an earlier transfer, or from uninitialized memory. Drop frames shorter than ETH_HLEN, and frames whose claimed length, plus the 0x8513 header, does not fit in the bytes actually received, and count them as length errors. urb->actual_length never exceeds the PEGASUS_MTU sized transfer buffer, so this also covers the existing PEGASUS_MTU check. Valid Ethernet frames are at least 60 bytes long without the FCS, so they are not affected. Found by code review with LLM assistance. With an emulated USB device, a 101-byte transfer claiming a 1500-byte frame was passed up as a 1500-byte packet before this change and is dropped after it, and frames claiming 0, 4 and 13 bytes were passed up and are now dropped and counted in rx_length_errors. The extra bytes happened to be zero in the first test, so disclosure of actual kernel data was not demonstrated.
https://git.kernel.org/stable/c/efee699f6de06611234ef9b0abd52db1340e5452
https://git.kernel.org/stable/c/eb13f958159f481ea45640a3c9d2fc2cbc0cf1a1
https://git.kernel.org/stable/c/da9b52e9b2fe357adf94440c11278f2b40344a30
https://git.kernel.org/stable/c/c160b4490d5ed9e4d8fa3c602583858f89cfc80a
https://git.kernel.org/stable/c/8c0f5e2babfa63b13c2bf0b9624ce519fd1d2207
https://git.kernel.org/stable/c/76ff3ffdc8d3a83e0d12143e17053747200cf9f8
https://git.kernel.org/stable/c/735008c0ed2d1e85900ef7473d50eda63ee47598
https://git.kernel.org/stable/c/1179a864db9dff2258d72deee2348d967cfd6f29