CVE-2026-142990: usb: usbtest: prevent divide by zero in simple_io() with zero length
In the Linux kernel, the following vulnerability has been resolved:
usb: usbtest: prevent divide by zero in simpleio() with zero length
A divide error oops was observed in simpleio():
usbtest 1-1:1.0: TEST 3: write/1 0..0 bytes 16307 times Oops: divide error: 0000 [#1] SMP KASAN RIP: 0010:simpleio+0x2c4/0x540 drivers/usb/misc/usbtest.c:497
The variable-length tests (test 3 and test 4) compute the next URB size with "len %= max", where max is the original urb->transferbufferlength. However, when a zero-length transfer is requested (param->length == 0), simpleallocurb() still returns a valid URB with transferbufferlength set to 0. On the first vary update, "len %= max" divides by zero and the kernel oopses.
Commit 564e69893c63 ("USB: usbtest: prevent a divide by zero bug") added the equivalent zero check to allocsglist(), which covers the scatterlist tests (test 7/8), but the single-URB variable-length path in simpleio() was left unprotected.
Fix this by returning -EINVAL early from simpleio() when vary is requested but max is zero, so the divide by zero never occurs. Zero-length transfers without vary remain valid for the other callers of simpleio().
Affected Software
Event History
Frequently Asked Questions
What conditions trigger the kernel crash?
The crash requires the usbtest driver's variable-length single-URB tests (test 3 or test 4) to request a zero-length transfer. That combination causes the next transfer-size calculation to divide by a zero transfer-buffer length.
Are zero-length USB transfers generally affected?
No. Zero-length transfers that do not use variable sizing remain valid for other simple_io() callers; the issue is specific to variable-length operation with a zero maximum length.
What can be done if the fix cannot be deployed immediately?
Do not run usbtest test 3 or test 4 with a requested length of zero. This avoids the divide-by-zero path and resulting kernel oops.
How can I identify whether this issue has occurred?
Look for a kernel divide-error oops with simple_io() in drivers/usb/misc/usbtest.c, potentially preceded by a usbtest message showing TEST 3 and a 0..0-byte write range.