The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x d6fef34ee4d102be448146f24caf96d7b4a05401 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023113023-heaviness-easel-554e@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: d6fef34ee4d1 ("io_uring: fix off-by one bvec index") 57bebf807e2a ("io_uring/rsrc: optimise registered huge pages") b000ae0ec2d7 ("io_uring/rsrc: optimise single entry advance") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From d6fef34ee4d102be448146f24caf96d7b4a05401 Mon Sep 17 00:00:00 2001 From: Keith Busch <kbusch@xxxxxxxxxx> Date: Mon, 20 Nov 2023 14:18:31 -0800 Subject: [PATCH] io_uring: fix off-by one bvec index If the offset equals the bv_len of the first registered bvec, then the request does not include any of that first bvec. Skip it so that drivers don't have to deal with a zero length bvec, which was observed to break NVMe's PRP list creation. Cc: stable@xxxxxxxxxxxxxxx Fixes: bd11b3a391e3 ("io_uring: don't use iov_iter_advance() for fixed buffers") Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx> Link: https://lore.kernel.org/r/20231120221831.2646460-1-kbusch@xxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 7034be555334..f521c5965a93 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1258,7 +1258,7 @@ int io_import_fixed(int ddir, struct iov_iter *iter, */ const struct bio_vec *bvec = imu->bvec; - if (offset <= bvec->bv_len) { + if (offset < bvec->bv_len) { /* * Note, huge pages buffers consists of one large * bvec entry and should always go this way. The other