Two fixes for read_bulk_callback(), both reachable by a USB device that
identifies itself as a Pegasus II adapter.
Patch 1 fixes an out-of-bounds write: on the 0x8513, every frame that
is dropped because of an oversized length field advances the receive
buffer by two bytes, until the host controller writes past the end of
the skb data area.
Patch 2 drops frames whose claimed length exceeds the data actually
received, instead of passing the uninitialized remainder of the receive
buffer up the stack.
Both bugs need a malicious or emulated USB device, which
Documentation/process/threat-model.rst treats as a regular bug rather
than a vulnerability, so they are posted publicly.
Testing: the series builds without warnings (W=1) on net and passes
checkpatch --strict. It applies unchanged to v6.12.105, where it was
tested on a KASAN kernel with a device emulated by raw-gadget +
dummy_hcd:
- 3000 frames with pkt_len 0xfff, then 20 valid frames. Before: KASAN
slab-out-of-bounds writes and a general protection fault in
skb_release_data(). After: no KASAN reports, and all 20 valid frames
are received.
- Five each of: 1536-byte transfers with pkt_len 1534, 1535 and 1536;
101-byte transfers claiming 1500 and 97 bytes; normal frames.
Before: all 30 received. After: the 15 that fit are received, and
rx_bytes matches; the rest are dropped.
Both bugs were found, and the patches written, with LLM assistance,
hence the Assisted-by tags.
Wei Jie Law (2):
net: usb: pegasus: do not advance rx_skb->data on dropped frames
net: usb: pegasus: check rx pkt_len against the received length
drivers/net/usb/pegasus.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
base-commit: af32da41b0327b9c6a37856ba82b6760d6c8d10e
--
2.43.0