We should return ENOMEM for memory allocation failures, fix this issue for io_alloc_async_ctx() calls. Signed-off-by: Xiaoguang Wang <xiaoguang.wang@xxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 6ac830b2b4fb..42a49a7e7792 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4993,7 +4993,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe) return 0; if (!req->io && io_alloc_async_ctx(req)) - return -EAGAIN; + return -ENOMEM; ret = io_req_defer_prep(req, sqe); if (ret < 0) @@ -5695,7 +5695,7 @@ static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, ctx->drain_next = 1; } if (io_alloc_async_ctx(req)) { - ret = -EAGAIN; + ret = -ENOMEM; goto err_req; } @@ -5723,7 +5723,7 @@ static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, INIT_LIST_HEAD(&req->link_list); if (io_alloc_async_ctx(req)) { - ret = -EAGAIN; + ret = -ENOMEM; goto err_req; } ret = io_req_defer_prep(req, sqe); -- 2.17.2