From: Pavel Begunkov asml.silence@gmail.com
mainline inclusion from mainline-5.7-rc4 commit 4ee3631451c9a62e6b6bc7ee51fb9a5b34e33509 category: feature bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27 CVE: NA ---------------------------
io_req_defer() do double-checked locking. Use proper helpers for that, i.e. list_empty_careful().
Signed-off-by: Pavel Begunkov asml.silence@gmail.com Signed-off-by: Jens Axboe axboe@kernel.dk Signed-off-by: yangerkun yangerkun@huawei.com Reviewed-by: zhangyi (F) yi.zhang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c index 3652a2e49ccc..1468a79acf3f 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4974,7 +4974,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe) int ret;
/* Still need defer if there is pending req in defer list. */ - if (!req_need_defer(req) && list_empty(&ctx->defer_list)) + if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list)) return 0;
if (!req->io && io_alloc_async_ctx(req))