* [PATCH v2 0/2] nvmet: fix file backend short I/O and LBA range checks
@ 2026-11-12 14:00 shao.mingyin
[not found] ` <20261112220105340AIwfaxoF7-iONJ2bZlEqI@zte.com.cn>
[not found] ` <20261112220106682vEsVrn_uCY7k7JVslANjN@zte.com.cn>
0 siblings, 2 replies; 3+ messages in thread
From: shao.mingyin @ 2026-11-12 14:00 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi, linux-nvme; +Cc: linux-kernel, stable
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.
The two patches are independent and can be applied in any order. Both
carry Fixes: and Cc: stable.
Changes in v2 (Christoph Hellwig):
- Patch 2: use the shared LBA range helper for reads and writes, with
pos64 local to the helper. No functional change from v1.
- Patch 1: unchanged; add Christoph Hellwig's Reviewed-by tag.
Link to v1: https://lore.kernel.org/all/20261111224134934XG6vMtntrNJQL1ztj7imr@zte.com.cn/
Shao Mingyin (2):
nvmet: handle short reads and writes in the file backend
nvmet: use overflow-safe range checks in the file backend
drivers/nvme/target/io-cmd-file.c | 47 ++++++++++++++++++++++++++++-----------
1 file changed, 34 insertions(+), 13 deletions(-)
---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-12 21:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 14:00 [PATCH v2 0/2] nvmet: fix file backend short I/O and LBA range checks shao.mingyin
[not found] ` <20261112220105340AIwfaxoF7-iONJ2bZlEqI@zte.com.cn>
2026-11-12 21:09 ` [PATCH v2 1/2] nvmet: handle short reads and writes in the file backend Christoph Hellwig
[not found] ` <20261112220106682vEsVrn_uCY7k7JVslANjN@zte.com.cn>
2026-11-12 21:09 ` [PATCH v2 2/2] nvmet: use overflow-safe range checks " Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox