[PATCH] io_uring/nop: pass all errors to userspace

Alexander A. Klimov posted 1 patch 4 days, 3 hours ago
io_uring/nop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] io_uring/nop: pass all errors to userspace
Posted by Alexander A. Klimov 4 days, 3 hours ago
This fixes an inconsistency where io_nop() called req_set_fail()
based on ret, but passed just nop->result to userspace.
Originally, ret is a even copy of nop->result, but is set to an error
when such happens subsequently. Now that's also passed to userspace.

Fixes: a85f31052bce ("io_uring/nop: add support for testing registered files and buffers")
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
---
 io_uring/nop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_uring/nop.c b/io_uring/nop.c
index 3caf07878f8a..f5c9969e7f64 100644
--- a/io_uring/nop.c
+++ b/io_uring/nop.c
@@ -79,9 +79,9 @@ int io_nop(struct io_kiocb *req, unsigned int issue_flags)
 	if (ret < 0)
 		req_set_fail(req);
 	if (nop->flags & IORING_NOP_CQE32)
-		io_req_set_res32(req, nop->result, 0, nop->extra1, nop->extra2);
+		io_req_set_res32(req, ret, 0, nop->extra1, nop->extra2);
 	else
-		io_req_set_res(req, nop->result, 0);
+		io_req_set_res(req, ret, 0);
 	if (nop->flags & IORING_NOP_TW) {
 		req->io_task_work.func = io_req_task_complete;
 		io_req_task_work_add(req);
-- 
2.54.0
Re: [PATCH] io_uring/nop: pass all errors to userspace
Posted by Jens Axboe 3 days, 4 hours ago
On Wed, 20 May 2026 20:00:44 +0200, Alexander A. Klimov wrote:
> This fixes an inconsistency where io_nop() called req_set_fail()
> based on ret, but passed just nop->result to userspace.
> Originally, ret is a even copy of nop->result, but is set to an error
> when such happens subsequently. Now that's also passed to userspace.

Applied, thanks!

[1/1] io_uring/nop: pass all errors to userspace
      commit: e97ff8b62d4690c69297f0f6de874f0564cc01a4

Best regards,
-- 
Jens Axboe