diff --git a/fs/io_uring.c b/fs/io_uring.c index e54556b0fcc6..c96d0c361ff0 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1789,10 +1789,12 @@ static int io_setup_async_rw(struct io_kiocb *req, ssize_t io_size, if (req->opcode == IORING_OP_READ_FIXED || req->opcode == IORING_OP_WRITE_FIXED) return 0; - if (!req->io && io_alloc_async_ctx(req)) - return -ENOMEM; + if (!req->io) { + if (io_alloc_async_ctx(req)) + return -ENOMEM; - io_req_map_rw(req, io_size, iovec, fast_iov, iter); + io_req_map_rw(req, io_size, iovec, fast_iov, iter); + } req->work.func = io_rw_async; return 0; }