提交 a1be6c19 编写于 作者: P Pavel Begunkov 提交者: Xiaoguang Wang

io_uring: fix flush req->refs underflow

to #28736503

commit 4518a3cc273cf82efdd36522fb1f13baad173c70 upstream

In io_uring_cancel_files(), after refcount_sub_and_test() leaves 0
req->refs, it calls io_put_req(), which would also put a ref. Call
io_free_req() instead.

Cc: stable@vger.kernel.org
Fixes: 2ca10259b418 ("io_uring: prune request from overflow list on flush")
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 bc430a1c
...@@ -7446,7 +7446,7 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, ...@@ -7446,7 +7446,7 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx,
* all we had, then we're done with this request. * all we had, then we're done with this request.
*/ */
if (refcount_sub_and_test(2, &cancel_req->refs)) { if (refcount_sub_and_test(2, &cancel_req->refs)) {
io_put_req(cancel_req); io_free_req(cancel_req);
finish_wait(&ctx->inflight_wait, &wait); finish_wait(&ctx->inflight_wait, &wait);
continue; continue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册