Commit 0839d957 authored by Li Lingfeng's avatar Li Lingfeng Committed by Jialin Zhang
Browse files

Revert "io_uring: don't take uring_lock during iowq cancel"

Offering: HULK
hulk inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I6BTWC



-------------------------------

This reverts commit c5562a26.

We need to apply patch 788d0824269bef (io_uring: import 5.15-stable
io_uring) to move io_uring to separate directory and solve
the problem of CVE-2023-0240.
This patch can be replaced by the same one from stable/5.10 to
eliminate conflicts.

Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Reviewed-by: default avatarWang Weiyang <wangweiyang2@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 8d894ade
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -2102,9 +2102,7 @@ static void io_req_task_cancel(struct callback_head *cb)
	struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
	struct io_ring_ctx *ctx = req->ctx;

	mutex_lock(&ctx->uring_lock);
	__io_req_task_cancel(req, -ECANCELED);
	mutex_unlock(&ctx->uring_lock);
	percpu_ref_put(&ctx->refs);
}

@@ -6127,11 +6125,7 @@ static struct io_wq_work *io_wq_submit_work(struct io_wq_work *work)
	/* if NO_CANCEL is set, we must still run the work */
	if ((work->flags & (IO_WQ_WORK_CANCEL|IO_WQ_WORK_NO_CANCEL)) ==
				IO_WQ_WORK_CANCEL) {
		/* io-wq is going to take down one */
		refcount_inc(&req->refs);
		percpu_ref_get(&req->ctx->refs);
		io_req_task_work_add_fallback(req, io_req_task_cancel);
		return io_steal_work(req);
		ret = -ECANCELED;
	}

	if (!ret) {