summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-03-17 05:24:47 +0300
committerJens Axboe <axboe@kernel.dk>2022-03-17 05:24:47 +0300
commitb91ef1872869d99cd42e908eb9754b81115c2c05 (patch)
treec64e5924c210bbfa67c70a4d80c0e71dd33b4ccc /fs/io_uring.c
parent3b2b78a8eb7cc38d207c5ee516769bc3f44d19ea (diff)
downloadlinux-b91ef1872869d99cd42e908eb9754b81115c2c05.tar.xz
io_uring: fix provided buffer return on failure for kiocb_done()
Use io_req_complete_failed() in kiocb_done(). This cleans up the code, but also ensures that a provided buffers is correctly freed on failure. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/a4880106fcf199d5810707fe2d17126fcdf18bc4.1647481208.git.asml.silence@gmail.com [axboe: split from previous patch] Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index a90844bf9b9c..f039706bce0e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3242,14 +3242,10 @@ static void kiocb_done(struct io_kiocb *req, ssize_t ret,
if (req->flags & REQ_F_REISSUE) {
req->flags &= ~REQ_F_REISSUE;
- if (io_resubmit_prep(req)) {
+ if (io_resubmit_prep(req))
io_req_task_queue_reissue(req);
- } else {
- req_set_fail(req);
- req->result = ret;
- req->io_task_work.func = io_req_task_complete;
- io_req_task_work_add(req, false);
- }
+ else
+ io_req_task_queue_fail(req, ret);
}
}