public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_files_update_prep shouldn't consider all the flags invalid
@ 2020-07-14 17:32 Daniele Salvatore Albano
  2020-07-17 16:13 ` Daniele Salvatore Albano
  0 siblings, 1 reply; 8+ messages in thread
From: Daniele Salvatore Albano @ 2020-07-14 17:32 UTC (permalink / raw)
  To: io-uring

Currently when an IORING_OP_FILES_UPDATE is submitted with the
IOSQE_IO_LINK flag it fails with EINVAL even if it's considered a
valid because the expectation is that there are no flags set for the
sqe.

The patch updates the check to allow IOSQE_IO_LINK and ensure that
EINVAL is returned only for IOSQE_FIXED_FILE and IOSQE_BUFFER_SELECT.

Signed-off-by: Daniele Albano <[email protected]>
---
 fs/io_uring.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ba70dc62f15f..7058b1a0bd39 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5205,7 +5205,14 @@ static int io_async_cancel(struct io_kiocb *req)
 static int io_files_update_prep(struct io_kiocb *req,
                                const struct io_uring_sqe *sqe)
 {
-       if (sqe->flags || sqe->ioprio || sqe->rw_flags)
+       unsigned flags = 0;
+
+       if (sqe->ioprio || sqe->rw_flags)
+               return -EINVAL;
+
+       flags = READ_ONCE(sqe->flags);
+
+       if (flags & (IOSQE_FIXED_FILE | IOSQE_BUFFER_SELECT))
                return -EINVAL;

        req->files_update.offset = READ_ONCE(sqe->off);
--
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-18 20:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14 17:32 [PATCH] io_files_update_prep shouldn't consider all the flags invalid Daniele Salvatore Albano
2020-07-17 16:13 ` Daniele Salvatore Albano
2020-07-17 16:21   ` Jens Axboe
2020-07-17 22:39     ` Daniele Salvatore Albano
2020-07-17 22:48       ` Jens Axboe
2020-07-18 17:29         ` Daniele Salvatore Albano
2020-07-18 20:23           ` Jens Axboe
2020-07-18 20:48             ` Daniele Salvatore Albano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox