From: Caleb Sander Mateos Date: Thu, 4 Sep 2025 16:12:22 +0000 (-0600) Subject: io_uring: remove WRITE_ONCE() in io_uring_create() X-Git-Tag: v6.18-rc1~137^2~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2685729fa5463e5fc493244a2ba7e260217fc76;p=thirdparty%2Fkernel%2Fstable.git io_uring: remove WRITE_ONCE() in io_uring_create() There's no need to use WRITE_ONCE() to set ctx->submitter_task in io_uring_create() since no other task can access the io_ring_ctx until a file descriptor is associated with it. So use a normal assignment instead of WRITE_ONCE(). Signed-off-by: Caleb Sander Mateos Link: https://lore.kernel.org/r/20250904161223.2600435-1-csander@purestorage.com Signed-off-by: Jens Axboe --- diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 6c07efac977ce..20dfa5ef75dcc 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3891,8 +3891,13 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p, } if (ctx->flags & IORING_SETUP_SINGLE_ISSUER - && !(ctx->flags & IORING_SETUP_R_DISABLED)) - WRITE_ONCE(ctx->submitter_task, get_task_struct(current)); + && !(ctx->flags & IORING_SETUP_R_DISABLED)) { + /* + * Unlike io_register_enable_rings(), don't need WRITE_ONCE() + * since ctx isn't yet accessible from other tasks + */ + ctx->submitter_task = get_task_struct(current); + } file = io_uring_get_file(ctx); if (IS_ERR(file)) {