]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: add IOPOLL and reserved field checks to IORING_OP_RENAMEAT
authorJens Axboe <axboe@kernel.dk>
Wed, 23 Jun 2021 15:04:13 +0000 (09:04 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 15:00:31 +0000 (17:00 +0200)
commit ed7eb2592286ead7d3bfdf8adf65e65392167cc4 upstream.

We can't support IOPOLL with non-pollable request types, and we should
check for unused/reserved fields like we do for other request types.

Fixes: 80a261fd0032 ("io_uring: add support for IORING_OP_RENAMEAT")
Cc: stable@vger.kernel.org
Reported-by: Dmitry Kadashev <dkadashev@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c

index c6e76c4fe706d7151559f696bdf10482cdf5ecbe..bdf619bf4ae611f3985c8a945fe4eb3dc2833212 100644 (file)
@@ -3497,6 +3497,10 @@ static int io_renameat_prep(struct io_kiocb *req,
        struct io_rename *ren = &req->rename;
        const char __user *oldf, *newf;
 
+       if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+               return -EINVAL;
+       if (sqe->ioprio || sqe->buf_index)
+               return -EINVAL;
        if (unlikely(req->flags & REQ_F_FIXED_FILE))
                return -EBADF;