io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniele Salvatore Albano <d.albano@gmail.com>
To: io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH] io_files_update_prep shouldn't consider all the flags invalid
Date: Fri, 17 Jul 2020 17:13:07 +0100	[thread overview]
Message-ID: <CAKq9yRiSyHJu7voNUiXbwm36cRjU+VdcSXYkGPDGWai0w8BG=w@mail.gmail.com> (raw)
In-Reply-To: <CAKq9yRh2Q2fJuEM1X6GV+G7dAyGv2=wdGbPQ4X0y_CP=wJcKwg@mail.gmail.com>

On Tue, 14 Jul 2020 at 18:32, Daniele Salvatore Albano
<d.albano@gmail.com> wrote:
>
> 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 <d.albano@gmail.com>
> ---
>  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

Hi,

Did you get the chance to review this patch? Would you prefer to get
the flags loaded before the first branching?

Thanks!

Daniele

  reply	other threads:[~2020-07-17 16:13 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 [this message]
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

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='CAKq9yRiSyHJu7voNUiXbwm36cRjU+VdcSXYkGPDGWai0w8BG=w@mail.gmail.com' \
    --to=d.albano@gmail.com \
    --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).