Skip to content

Commit

Permalink
io_uring: ensure that send/sendmsg and recv/recvmsg check sqe->ioprio
Browse files Browse the repository at this point in the history
commit 7391142 upstream.

All other opcodes correctly check if this is set and -EINVAL if it is
and they don't support that field, for some reason the these were
forgotten.

This was unified a bit differently in the upstream tree, but had the
same effect as making sure we error on this field. Rather than have
a painful backport of the upstream commit, just fixup the mentioned
opcodes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
axboe authored and gregkh committed Jul 7, 2022
1 parent b8def02 commit c9fc52c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -4366,6 +4366,8 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)

if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
return -EINVAL;
if (unlikely(sqe->addr2 || sqe->splice_fd_in || sqe->ioprio))
return -EINVAL;

sr->msg_flags = READ_ONCE(sqe->msg_flags);
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
Expand Down Expand Up @@ -4601,6 +4603,8 @@ static int io_recvmsg_prep(struct io_kiocb *req,

if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
return -EINVAL;
if (unlikely(sqe->addr2 || sqe->splice_fd_in || sqe->ioprio))
return -EINVAL;

sr->msg_flags = READ_ONCE(sqe->msg_flags);
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
Expand Down

0 comments on commit c9fc52c

Please sign in to comment.