summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/exported-sql-viewer.py
diff options
context:
space:
mode:
authorYuanZhe Liu <25031212351@stu.xidian.edu.cn>2026-10-16 15:27:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-10-29 11:06:39 +0100
commitfdaca138694111153f96c7d76877734b9dbf0e01 (patch)
treea85f96fa05f5d15f5427969d9c0939a99a20c7b9 /tools/perf/scripts/python/exported-sql-viewer.py
parentfafd23d61494461256d374f67c121f2712e1af2f (diff)
usb: usbtest: prevent divide by zero in simple_io() with zero length
A divide error oops was observed in simple_io(): usbtest 1-1:1.0: TEST 3: write/1 0..0 bytes 16307 times Oops: divide error: 0000 [#1] SMP KASAN RIP: 0010:simple_io+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->transfer_buffer_length. However, when a zero-length transfer is requested (param->length == 0), simple_alloc_urb() still returns a valid URB with transfer_buffer_length 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 alloc_sglist(), which covers the scatterlist tests (test 7/8), but the single-URB variable-length path in simple_io() was left unprotected. Fix this by returning -EINVAL early from simple_io() 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 simple_io(). Cc: stable <stable@kernel.org> Co-developed-by: Bin Yu <byu@xidian.edu.cn> Signed-off-by: Bin Yu <byu@xidian.edu.cn> Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn> Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn> Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Link: https://patch.msgid.link/20261016072750.34256-1-25031212351@stu.xidian.edu.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions