public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: gregkh@linuxfoundation.org, kbusch@kernel.org
Cc: stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] io_uring: fix off-by one bvec index" failed to apply to 5.4-stable tree
Date: Thu, 30 Nov 2023 07:36:17 -0700	[thread overview]
Message-ID: <bc136dd7-9b65-4d10-8b0d-105c90246543@kernel.dk> (raw)
In-Reply-To: <2023113025-eastbound-uninstall-c2e0@gregkh>

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

On 11/30/23 7:31 AM, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 5.4-stable tree.

And the 5.4 variant attached.

-- 
Jens Axboe


[-- Attachment #2: 5.4-io_uring-fix-off-by-one-bvec-index.patch --]
[-- Type: text/x-patch, Size: 1259 bytes --]

From aa4df1efa47241f8b9faab93f9d73eda4aa9ccf3 Mon Sep 17 00:00:00 2001
From: Keith Busch <kbusch@kernel.org>
Date: Mon, 20 Nov 2023 14:18:31 -0800
Subject: [PATCH] io_uring: fix off-by one bvec index

commit d6fef34ee4d102be448146f24caf96d7b4a05401 upstream.

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@vger.kernel.org
Fixes: bd11b3a391e3 ("io_uring: don't use iov_iter_advance() for fixed buffers")
Signed-off-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20231120221831.2646460-1-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3683ddeb625a..adc263400471 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1256,7 +1256,7 @@ static int io_import_fixed(struct io_ring_ctx *ctx, int rw,
 		 */
 		const struct bio_vec *bvec = imu->bvec;
 
-		if (offset <= bvec->bv_len) {
+		if (offset < bvec->bv_len) {
 			iov_iter_advance(iter, offset);
 		} else {
 			unsigned long seg_skip;
-- 
2.42.0


  reply	other threads:[~2023-11-30 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 14:31 FAILED: patch "[PATCH] io_uring: fix off-by one bvec index" failed to apply to 5.4-stable tree gregkh
2023-11-30 14:36 ` Jens Axboe [this message]
2023-11-30 15:05   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc136dd7-9b65-4d10-8b0d-105c90246543@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbusch@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox