This is a note to let you know that I've just added the patch titled io_uring/uring_cmd: don't assume io_uring_cmd_data layout to the 6.13-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-uring_cmd-don-t-assume-io_uring_cmd_data-la.patch and it can be found in the queue-6.13 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 4d6ec1ef4bd63fd08c146120dd3aa9dad56a90c8 Author: Caleb Sander Mateos <csander@xxxxxxxxxxxxxxx> Date: Wed Feb 12 13:45:45 2025 -0700 io_uring/uring_cmd: don't assume io_uring_cmd_data layout [ Upstream commit 34cae91215c6f65bed2a124fb9283da6ec0b8dd9 ] eaf72f7b414f ("io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout") removed most of the places assuming struct io_uring_cmd_data has sqes as its first field. However, the EAGAIN case in io_uring_cmd() still compares ioucmd->sqe to the struct io_uring_cmd_data pointer using a void * cast. Since fa3595523d72 ("io_uring: get rid of alloc cache init_once handling"), sqes is no longer io_uring_cmd_data's first field. As a result, the pointers will always compare unequal and memcpy() may be called with the same source and destination. Replace the incorrect void * cast with the address of the sqes field. Signed-off-by: Caleb Sander Mateos <csander@xxxxxxxxxxxxxxx> Fixes: eaf72f7b414f ("io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout") Link: https://lore.kernel.org/r/20250212204546.3751645-2-csander@xxxxxxxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Stable-dep-of: e663da62ba86 ("io_uring/uring_cmd: switch sqe to async_data on EAGAIN") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index caed143fb156d..b72154fefbee9 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -268,7 +268,7 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags) if (ret == -EAGAIN) { struct io_uring_cmd_data *cache = req->async_data; - if (ioucmd->sqe != (void *) cache) + if (ioucmd->sqe != cache->sqes) memcpy(cache->sqes, ioucmd->sqe, uring_sqe_size(req->ctx)); return -EAGAIN; } else if (ret == -EIOCBQUEUED) {