This is a note to let you know that I've just added the patch titled io_uring/rsrc: check for nonconsecutive pages to the 6.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-rsrc-check-for-nonconsecutive-pages.patch and it can be found in the queue-6.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 776617db78c6d208780e7c69d4d68d1fa82913de Mon Sep 17 00:00:00 2001 From: Tobias Holl <tobias@xxxxxxxxx> Date: Wed, 3 May 2023 08:59:50 -0600 Subject: io_uring/rsrc: check for nonconsecutive pages From: Tobias Holl <tobias@xxxxxxxxx> commit 776617db78c6d208780e7c69d4d68d1fa82913de upstream. Pages that are from the same folio do not necessarily need to be consecutive. In that case, we cannot consolidate them into a single bvec entry. Before applying the huge page optimization from commit 57bebf807e2a ("io_uring/rsrc: optimise registered huge pages"), check that the memory is actually consecutive. Cc: stable@xxxxxxxxxxxxxxx Fixes: 57bebf807e2a ("io_uring/rsrc: optimise registered huge pages") Signed-off-by: Tobias Holl <tobias@xxxxxxxxx> [axboe: formatting] Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- io_uring/rsrc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1230,7 +1230,12 @@ static int io_sqe_buffer_register(struct if (nr_pages > 1) { folio = page_folio(pages[0]); for (i = 1; i < nr_pages; i++) { - if (page_folio(pages[i]) != folio) { + /* + * Pages must be consecutive and on the same folio for + * this to work + */ + if (page_folio(pages[i]) != folio || + pages[i] != pages[i - 1] + 1) { folio = NULL; break; } Patches currently in stable-queue which might be from tobias@xxxxxxxxx are queue-6.3/io_uring-rsrc-check-for-nonconsecutive-pages.patch