summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-04-26 19:34:11 -0600
committerJens Axboe <axboe@kernel.dk>2022-04-26 20:48:31 -0600
commit588faa1ea5eecb351100ee5d187b9be99210f70d (patch)
tree276597da2d81c4818efa773b424a48391680bcfc /fs
parentc0713540f6d55c53dca65baaead55a5a8b20552d (diff)
io_uring: check reserved fields for send/sendmsg
We should check unused fields for non-zero and -EINVAL if they are set, making it consistent with other opcodes. Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()") Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 7625b29153b9..136c2fc49a1e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5207,6 +5207,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->file_index))
+ return -EINVAL;
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
sr->len = READ_ONCE(sqe->len);