]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
null_blk: fix zone read length beyond write pointer
authorKeith Busch <kbusch@kernel.org>
Wed, 12 Nov 2025 16:42:18 +0000 (08:42 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Nov 2025 17:02:56 +0000 (10:02 -0700)
commit3749ea4deeba6049ea97e653d964568a45543e37
treebdb1be4727192985500c86366c58e54c8de15192
parent6d7e3870af11c2b5966b2769f9e8a0d4764f52cc
null_blk: fix zone read length beyond write pointer

Fix up the divisor calculating the number of zone sectors being read and
handle a read that straddles the zone write pointer. The length is
rounded up a sector boundary, so be sure to truncate any excess bytes
off to avoid copying past the data segment.

Fixes: 3451cf34f51bb70 ("null_blk: allow byte aligned memory offsets")
Signed-off-by: Keith Busch <kbusch@kernel.org>
Tested-by: Bart van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk/main.c
drivers/block/null_blk/zoned.c