projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5562a8d
)
io_uring: fix no lock protection for ctx->cq_extra
author
Hao Xu
<haoxu@linux.alibaba.com>
Thu, 25 Nov 2021 09:21:02 +0000
(17:21 +0800)
committer
Jens Axboe
<axboe@kernel.dk>
Thu, 25 Nov 2021 16:00:42 +0000
(09:00 -0700)
ctx->cq_extra should be protected by completion lock so that the
req_need_defer() does the right check.
Cc: stable@vger.kernel.org
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Link:
https://lore.kernel.org/r/20211125092103.224502-2-haoxu@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
patch
|
blob
|
history
diff --git
a/fs/io_uring.c
b/fs/io_uring.c
index f666a0e7f5e858083eb354d017a96700ad3535bd..ae9534382b26764bfc9d31e2360277119913060a 100644
(file)
--- a/
fs/io_uring.c
+++ b/
fs/io_uring.c
@@
-6537,12
+6537,15
@@
static __cold void io_drain_req(struct io_kiocb *req)
u32 seq = io_get_sequence(req);
/* Still need defer if there is pending req in defer list. */
+ spin_lock(&ctx->completion_lock);
if (!req_need_defer(req, seq) && list_empty_careful(&ctx->defer_list)) {
+ spin_unlock(&ctx->completion_lock);
queue:
ctx->drain_active = false;
io_req_task_queue(req);
return;
}
+ spin_unlock(&ctx->completion_lock);
ret = io_req_prep_async(req);
if (ret) {