Skip to content

Commit a4d416d

Browse files
linke liaxboe
authored andcommitted
io_uring/msg_ring: reuse ctx->submitter_task read using READ_ONCE instead of re-reading it
In io_msg_exec_remote(), ctx->submitter_task is read using READ_ONCE at the beginning of the function, checked, and then re-read from ctx->submitter_task, voiding all guarantees of the checks. Reuse the value that was read by READ_ONCE to ensure the consistency of the task struct throughout the function. Signed-off-by: linke li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 039a2e8 commit a4d416d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/msg_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int io_msg_exec_remote(struct io_kiocb *req, task_work_func_t func)
8383
return -EOWNERDEAD;
8484

8585
init_task_work(&msg->tw, func);
86-
if (task_work_add(ctx->submitter_task, &msg->tw, TWA_SIGNAL))
86+
if (task_work_add(task, &msg->tw, TWA_SIGNAL))
8787
return -EOWNERDEAD;
8888

8989
return IOU_ISSUE_SKIP_COMPLETE;

0 commit comments

Comments
 (0)