Commit 8f3d7496 authored by Jens Axboe's avatar Jens Axboe
Browse files

io_uring: don't re-setup vecs/iter in io_resumit_prep() is already there



If we already have mapped the necessary data for retry, then don't set
it up again. It's a pointless operation, and we leak the iovec if it's
a large (non-stack) vec.

Fixes: b63534c4 ("io_uring: re-issue block requests that failed because of resources")
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6200b0ae
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2294,6 +2294,7 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
		goto end_req;
	}

	if (!req->io) {
		ret = io_import_iovec(rw, req, &iovec, &iter, false);
		if (ret < 0)
			goto end_req;
@@ -2301,6 +2302,9 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
		if (!ret)
			return true;
		kfree(iovec);
	} else {
		return true;
	}
end_req:
	req_set_fail_links(req);
	io_req_complete(req, ret);