From: Jens Axboe Date: Wed, 23 Jun 2021 15:07:45 +0000 (-0600) Subject: io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT X-Git-Tag: v5.12.17~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d62a74f2b90a51b873aa622ff768947eda99db1;p=thirdparty%2Fkernel%2Fstable.git io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT commit 22634bc5620d29765e5199c7b230a372c7ddcda2 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: 14a1143b68ee ("io_uring: add support for IORING_OP_UNLINKAT") Cc: stable@vger.kernel.org Reported-by: Dmitry Kadashev Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/io_uring.c b/fs/io_uring.c index bdf619bf4ae61..58ac04cca587f 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3548,6 +3548,10 @@ static int io_unlinkat_prep(struct io_kiocb *req, struct io_unlink *un = &req->unlink; const char __user *fname; + if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) + return -EINVAL; + if (sqe->ioprio || sqe->off || sqe->len || sqe->buf_index) + return -EINVAL; if (unlikely(req->flags & REQ_F_FIXED_FILE)) return -EBADF;