[PATCH] io_uring: set error code to be ENOMEM when io_alloc_async_ctx() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux