Skip to contentSkip to conversation

io_uring: fix provided buffer import

PATCH Applied Dylan Yudaken 2 participants 2 messages Jun 30, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix provided buffer import

io_import_iovec uses the s pointer, but this was changed immediately after the iovec was re-imported and so it was imported into the wrong place.

Change the ordering.

Fixes 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected buffers")
---
 fs/io_uring.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/io_uring.c +3 -2
index 5ff2cdb425bc..73ae92a62c2c 100644
@@ -4314,6 +4314,9 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
 		if (unlikely(ret < 0))
 			return ret;
 	} else {
+		rw = req->async_data;
+		s = &rw->s;
+
 		/*
 		 * Safe and required to re-import if we're using provided
 		 * buffers, as we dropped the selected one before retry.
@@ -4324,8 +4327,6 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
 				return ret;
 		}
 
-		rw = req->async_data;
-		s = &rw->s;
 		/*
 		 * We come here from an earlier attempt, restore our state to
 		 * match in case it doesn't. It's cheap enough that we don't
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 8 lines · Dylan Yudaken

io_import_iovec uses the s pointer, but this was changed immediately after the iovec was re-imported and so it was imported into the wrong place.

Change the ordering.

[...]

Applied, thanks!

[1/1] io_uring: fix provided buffer import

      commit: ee10e6851a687c58f516dc924034cb62c7a01e14

Best regards,

Signature · 1 line
Jens Axboe