io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniele Salvatore Albano <d.albano@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH] io_files_update_prep shouldn't consider all the flags invalid
Date: Sat, 18 Jul 2020 18:29:04 +0100	[thread overview]
Message-ID: <CAKq9yRjwp6_hYbG3j11ekAg_1iJ8h_aLM+Kq7uCmgYvOHESFaA@mail.gmail.com> (raw)
In-Reply-To: <4f0f5fba-797b-5505-b4fa-6e46b2b036e6@kernel.dk>

On Fri, 17 Jul 2020 at 23:48, Jens Axboe <axboe@kernel.dk> wrote:
>
> On 7/17/20 4:39 PM, Daniele Salvatore Albano wrote:
> > Sure thing, tomorrow I will put it together, review all the other ops
> > as well, just in case (although I believe you may already have done
> > it), and test it.
>
> I did take a quick look and these were the three I found. There
> shouldn't be others, so I think we're good there.
>
> > For the test cases, should I submit a separate patch for liburing or
> > do you prefer to use pull requests on gh?
>
> Either one is fine, I can work with either.
>
> --
> Jens Axboe
>

I changed the patch name considering that is now affecting multiple
functions, I will also create the PR for the test cases but it may
take a few days, I wasn't using the other 2 functions and need to do
some testing.

---

[PATCH] allow flags in io_timeout_remove_prep, io_async_cancel_prep
 and io_files_update_prep

io_timeout_remove_prep, io_async_cancel_prep and io_files_update_prep
should allow valid flags.

Signed-off-by: Daniele Albano <d.albano@gmail.com>
---
 fs/io_uring.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ba70dc62f15f..3101b4a36bc9 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5010,7 +5010,11 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
 {
        if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
                return -EINVAL;
-       if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->len)
+
+    if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
+        return -EINVAL;
+
+    if (unlikely(sqe->ioprio || sqe->buf_index || sqe->len))
                return -EINVAL;

        req->timeout.addr = READ_ONCE(sqe->addr);
@@ -5186,8 +5190,11 @@ static int io_async_cancel_prep(struct io_kiocb *req,
 {
        if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
                return -EINVAL;
-       if (sqe->flags || sqe->ioprio || sqe->off || sqe->len ||
-           sqe->cancel_flags)
+
+    if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
+        return -EINVAL;
+
+    if (unlikely(sqe->ioprio || sqe->off || sqe->len || sqe->cancel_flags))
                return -EINVAL;

        req->cancel.addr = READ_ONCE(sqe->addr);
@@ -5205,7 +5212,10 @@ 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)
+    if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
+        return -EINVAL;
+
+    if (unlikely(sqe->ioprio || sqe->rw_flags))
                return -EINVAL;

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

  reply	other threads:[~2020-07-18 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-07-18 20:23           ` Jens Axboe
2020-07-18 20:48             ` Daniele Salvatore Albano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKq9yRjwp6_hYbG3j11ekAg_1iJ8h_aLM+Kq7uCmgYvOHESFaA@mail.gmail.com \
    --to=d.albano@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).