Patch "io_uring: clean rings on NO_MMAP alloc fail" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    io_uring: clean rings on NO_MMAP alloc fail

to the 6.7-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-clean-rings-on-no_mmap-alloc-fail.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 05666f798bbbf9f565a4a8be94478f07c8701214
Author: Pavel Begunkov <asml.silence@xxxxxxxxx>
Date:   Tue Mar 12 14:56:27 2024 +0000

    io_uring: clean rings on NO_MMAP alloc fail
    
    [ Upstream commit cef59d1ea7170ec753182302645a0191c8aa3382 ]
    
    We make a few cancellation judgements based on ctx->rings, so let's
    zero it afer deallocation for IORING_SETUP_NO_MMAP just like it's
    done with the mmap case. Likely, it's not a real problem, but zeroing
    is safer and better tested.
    
    Cc: stable@xxxxxxxxxxxxxxx
    Fixes: 03d89a2de25bbc ("io_uring: support for user allocated memory for rings/sqes")
    Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
    Link: https://lore.kernel.org/r/9ff6cdf91429b8a51699c210e1f6af6ea3f8bdcf.1710255382.git.asml.silence@xxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 45d6e440bdc04..13a9d9fcd2ecd 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2757,14 +2757,15 @@ static void io_rings_free(struct io_ring_ctx *ctx)
 	if (!(ctx->flags & IORING_SETUP_NO_MMAP)) {
 		io_mem_free(ctx->rings);
 		io_mem_free(ctx->sq_sqes);
-		ctx->rings = NULL;
-		ctx->sq_sqes = NULL;
 	} else {
 		io_pages_free(&ctx->ring_pages, ctx->n_ring_pages);
 		ctx->n_ring_pages = 0;
 		io_pages_free(&ctx->sqe_pages, ctx->n_sqe_pages);
 		ctx->n_sqe_pages = 0;
 	}
+
+	ctx->rings = NULL;
+	ctx->sq_sqes = NULL;
 }
 
 void *io_mem_alloc(size_t size)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux