summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDylan Yudaken <dylany@fb.com>2022-04-12 19:30:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-20 10:34:12 +0300
commit22aa1597f462d2a917d1c6124cb33f520949936d (patch)
tree282c19805ca3f4d7da8c8e126209328a8c7fefba /fs
parentcb981d5c751197b95075e707179aee9cf63a1cac (diff)
downloadlinux-22aa1597f462d2a917d1c6124cb33f520949936d.tar.xz
io_uring: move io_uring_rsrc_update2 validation
[ Upstream commit 565c5e616e8061b40a2e1d786c418a7ac3503a8d ] Move validation to be more consistently straight after copy_from_user. This is already done in io_register_rsrc_update and so this removes that redundant check. Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220412163042.2788062-2-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3d44d48b35ea..0568304a597a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -10595,8 +10595,6 @@ static int __io_register_rsrc_update(struct io_ring_ctx *ctx, unsigned type,
__u32 tmp;
int err;
- if (up->resv)
- return -EINVAL;
if (check_add_overflow(up->offset, nr_args, &tmp))
return -EOVERFLOW;
err = io_rsrc_node_switch_start(ctx);
@@ -10622,6 +10620,8 @@ static int io_register_files_update(struct io_ring_ctx *ctx, void __user *arg,
memset(&up, 0, sizeof(up));
if (copy_from_user(&up, arg, sizeof(struct io_uring_rsrc_update)))
return -EFAULT;
+ if (up.resv)
+ return -EINVAL;
return __io_register_rsrc_update(ctx, IORING_RSRC_FILE, &up, nr_args);
}