projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
384d1b1
)
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
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:12:33 +0000
(19:12 +0100)
[ Upstream commit
e302f1046f4c209291b07ff7bc4d15ca26891f16
]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c
patch
|
blob
|
history
diff --git
a/fs/io_uring.c
b/fs/io_uring.c
index d7e49e87b49b951d5da9ec93dc8d4032010d9f8c..156c54ebb62b780a81ff4518a6f91951f5854fc3 100644
(file)
--- a/
fs/io_uring.c
+++ b/
fs/io_uring.c
@@
-6573,11
+6573,14
@@
static bool io_drain_req(struct io_kiocb *req)
}
/* Still need defer if there is pending req in defer list. */
+ spin_lock(&ctx->completion_lock);
if (likely(list_empty_careful(&ctx->defer_list) &&
!(req->flags & REQ_F_IO_DRAIN))) {
+ spin_unlock(&ctx->completion_lock);
ctx->drain_active = false;
return false;
}
+ spin_unlock(&ctx->completion_lock);
seq = io_get_sequence(req);
/* Still a chance to pass the sequence check */