io_uring: ensure that send/sendmsg and recv/recvmsg check sqe->ioprio

commit 73911426aa 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>
This commit is contained in:
Jens Axboe 2022-06-30 14:42:05 -06:00 коммит произвёл Greg Kroah-Hartman
Родитель c8fb40fd7b
Коммит 50fefe57f4
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -4788,6 +4788,8 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
return -EINVAL; return -EINVAL;
if (unlikely(sqe->addr2 || sqe->file_index)) if (unlikely(sqe->addr2 || sqe->file_index))
return -EINVAL; return -EINVAL;
if (unlikely(sqe->addr2 || sqe->file_index || sqe->ioprio))
return -EINVAL;
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
sr->len = READ_ONCE(sqe->len); sr->len = READ_ONCE(sqe->len);
@ -5011,6 +5013,8 @@ static int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
return -EINVAL; return -EINVAL;
if (unlikely(sqe->addr2 || sqe->file_index)) if (unlikely(sqe->addr2 || sqe->file_index))
return -EINVAL; return -EINVAL;
if (unlikely(sqe->addr2 || sqe->file_index || sqe->ioprio))
return -EINVAL;
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
sr->len = READ_ONCE(sqe->len); sr->len = READ_ONCE(sqe->len);