diff options
author | Jens Axboe <axboe@kernel.dk> | 2022-04-26 19:34:57 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-04-26 20:48:37 -0600 |
commit | 5a1e99b61b0c81388cde0c808b3e4173907df19f (patch) | |
tree | 87f1a705ad7cadf1cb07cbefd856589645a0c48d /fs | |
parent | 588faa1ea5eecb351100ee5d187b9be99210f70d (diff) | |
download | linux-5a1e99b61b0c81388cde0c808b3e4173907df19f.tar.gz linux-5a1e99b61b0c81388cde0c808b3e4173907df19f.tar.bz2 linux-5a1e99b61b0c81388cde0c808b3e4173907df19f.zip |
io_uring: check reserved fields for recv/recvmsg
We should check unused fields for non-zero and -EINVAL if they are set,
making it consistent with other opcodes.
Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 136c2fc49a1e..92ac50f139cd 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5420,6 +5420,8 @@ static int io_recvmsg_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); |