summaryrefslogtreecommitdiffstats
path: root/tools/lib/python
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2026-05-10 22:48:43 +0800
committerJens Axboe <axboe@kernel.dk>2026-05-11 07:44:20 -0600
commit1860c2f85922917d8a46f16a6f4bd2298ffa0fb5 (patch)
treea0f916e2d7e4fb67faae32efd6ae726adec464e1 /tools/lib/python
parentf7700a4415afb3ac1767a556094e4ef8bd440e41 (diff)
downloadlinux-1860c2f85922917d8a46f16a6f4bd2298ffa0fb5.tar.gz
linux-1860c2f85922917d8a46f16a6f4bd2298ffa0fb5.zip
ublk: reject max_sectors smaller than PAGE_SECTORS in parameter validation
blk_validate_limits() requires max_hw_sectors >= PAGE_SECTORS and fires a WARN_ON_ONCE if this invariant is violated. ublk_validate_params() only checked the upper bound of max_sectors against max_io_buf_bytes, allowing userspace to pass small values (including zero) that trigger the warning when blk_mq_alloc_disk() is called from ublk_ctrl_start_dev(). Before 494ea040bcb5, ublk used blk_queue_max_hw_sectors() which silently clamped small values up to PAGE_SECTORS. The conversion to passing queue_limits directly to blk_mq_alloc_disk() lost that clamping and now hits blk_validate_limits()'s WARN_ON_ONCE instead. Validate that max_sectors is at least PAGE_SECTORS in ublk_validate_params() so invalid values are rejected early with -EINVAL instead of reaching the block layer. Fixes: 494ea040bcb5 ("ublk: pass queue_limits to blk_mq_alloc_disk") Signed-off-by: Ming Lei <tom.leiming@gmail.com> Link: https://patch.msgid.link/20260510144843.769031-1-tom.leiming@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions