From: Jens Axboe Date: Wed, 27 Apr 2022 01:34:57 +0000 (-0600) Subject: io_uring: check reserved fields for recv/recvmsg X-Git-Tag: v5.15.38~66 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=37811e46a2329f844cc78d817492586ed7b3598b;p=wrapfs-4.13.y.git io_uring: check reserved fields for recv/recvmsg [ Upstream commit 5a1e99b61b0c81388cde0c808b3e4173907df19f ] 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 Signed-off-by: Sasha Levin --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 48c9a550e48c..7aad4bde92e9 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5009,6 +5009,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);