Skip to content

Commit

Permalink
io_uring: fix provided buffer return on failure for kiocb_done()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Mar 17, 2022
1 parent 3b2b78a commit b91ef18
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit b91ef18

Please sign in to comment.