Re: [PATCH v2 0/2] nvmet: fix file backend short I/O and LBA range checks
From: Keith Busch
Date: Mon Nov 16 2026 - 11:18:55 EST
On Thu, 12 Nov 2026 22:00:58 +0800 (CST), shao.mingyin@xxxxxxxxxx wrote:
> The file backend computes byte offsets from the LBA and block size with
> unchecked 64-bit arithmetic and does not handle short reads or writes.
> A host can therefore make the backend report success for a transfer that
> only covered part of the range, and a large LBA or length can wrap the
> range check and reach vfs_fallocate() with an out-of-range offset.
>
> Patch 1 makes nvmet_file_execute_io() stop at an incomplete submit
> instead of advancing the position and eventually reporting success, and
> converts a zero-byte completion on the common path to -EIO. Patch 2
> adds a shared overflow-safe range check and uses it for read, write,
> discard and write zeroes.
>
> [...]
Thanks, applied to nvme-7.4.
[1/2] nvmet: handle short reads and writes in the file backend
commit: 1738de07a79b9abdcffe03571c442033b80e7fed
[2/2] nvmet: use overflow-safe range checks in the file backend
commit: bcd5316e708d418f03707c183571549ad878cfff
--
Keith Busch <kbusch@xxxxxxxxxx>