Re: [PATCH] io_files_update_prep shouldn't consider all the flags invalid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 17 Jul 2020 at 23:48, Jens Axboe <axboe@xxxxxxxxx> 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@xxxxxxxxx>
---
 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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux