[PATCH v5 6/6] io_uring: finish IOPOLL/ioprio prep handler removal

Kanchan Joshi
2022-05-11T06:32:56Z

From: Jens Axboe <axboe@kernel.dk>

Commit 73911426aaaa unified the checking of this, but was done before we
had a few new opcode handlers.

Finish the job and apply it to the xattr/socket/uring_cmd handlers as
well so we check and use this fully consistently.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
fs/io_uring.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 592be5b89add..44c57dca358d 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4517,10 +4517,6 @@ static int __io_getxattr_prep(struct io_kiocb *req,
const char __user *name;
int ret;

- if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
- return -EINVAL;
- if (unlikely(sqe->ioprio))
- return -EINVAL;
if (unlikely(req->flags & REQ_F_FIXED_FILE))
return -EBADF;

@@ -4630,10 +4626,6 @@ static int __io_setxattr_prep(struct io_kiocb *req,
const char __user *name;
int ret;

- if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
- return -EINVAL;
- if (unlikely(sqe->ioprio))
- return -EINVAL;
if (unlikely(req->flags & REQ_F_FIXED_FILE))
return -EBADF;

@@ -4968,7 +4960,7 @@ static int io_uring_cmd_prep(struct io_kiocb *req,
{
struct io_uring_cmd *ioucmd = &req->uring_cmd;

- if (sqe->ioprio || sqe->rw_flags)
+ if (sqe->rw_flags)
return -EINVAL;
ioucmd->cmd = sqe->cmd;
ioucmd->cmd_op = READ_ONCE(sqe->cmd_op);
@@ -6405,9 +6397,7 @@ static int io_socket_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
struct io_socket *sock = &req->sock;

- if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
- return -EINVAL;
- if (sqe->ioprio || sqe->addr || sqe->rw_flags || sqe->buf_index)
+ if (sqe->addr || sqe->rw_flags || sqe->buf_index)
return -EINVAL;

sock->domain = READ_ONCE(sqe->fd);
--
2.25.1