aboutsummaryrefslogtreecommitdiff
path: root/io_uring/msg_ring.c
diff options
context:
space:
mode:
authorGravatar linke li <lilinke99@qq.com> 2024-04-26 11:24:37 +0800
committerGravatar Jens Axboe <axboe@kernel.dk> 2024-04-26 07:40:12 -0600
commita4d416dc60980f741f0bfa1f34a1059c498c1b4e (patch)
tree442b8419c20264d41a16b4be300c477a2c4e567e /io_uring/msg_ring.c
parentio_uring/rw: reinstate thread check for retries (diff)
downloadlinux-a4d416dc60980f741f0bfa1f34a1059c498c1b4e.tar.gz
linux-a4d416dc60980f741f0bfa1f34a1059c498c1b4e.tar.bz2
linux-a4d416dc60980f741f0bfa1f34a1059c498c1b4e.zip
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 <lilinke99@qq.com> Link: https://lore.kernel.org/r/tencent_F9B2296C93928D6F68FF0C95C33475C68209@qq.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/msg_ring.c')
-rw-r--r--io_uring/msg_ring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c
index cd6dcf634ba3..d74670b39ed6 100644
--- a/io_uring/msg_ring.c
+++ b/io_uring/msg_ring.c
@@ -83,7 +83,7 @@ static int io_msg_exec_remote(struct io_kiocb *req, task_work_func_t func)
return -EOWNERDEAD;
init_task_work(&msg->tw, func);
- if (task_work_add(ctx->submitter_task, &msg->tw, TWA_SIGNAL))
+ if (task_work_add(task, &msg->tw, TWA_SIGNAL))
return -EOWNERDEAD;
return IOU_ISSUE_SKIP_COMPLETE;