Skip to content

Commit 565c5e6

Browse files
Dylan Yudakenaxboe
authored andcommitted
io_uring: move io_uring_rsrc_update2 validation
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>
1 parent 0f8da75 commit 565c5e6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/io_uring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11398,8 +11398,6 @@ static int __io_register_rsrc_update(struct io_ring_ctx *ctx, unsigned type,
1139811398
__u32 tmp;
1139911399
int err;
1140011400

11401-
if (up->resv)
11402-
return -EINVAL;
1140311401
if (check_add_overflow(up->offset, nr_args, &tmp))
1140411402
return -EOVERFLOW;
1140511403
err = io_rsrc_node_switch_start(ctx);
@@ -11425,6 +11423,8 @@ static int io_register_files_update(struct io_ring_ctx *ctx, void __user *arg,
1142511423
memset(&up, 0, sizeof(up));
1142611424
if (copy_from_user(&up, arg, sizeof(struct io_uring_rsrc_update)))
1142711425
return -EFAULT;
11426+
if (up.resv)
11427+
return -EINVAL;
1142811428
return __io_register_rsrc_update(ctx, IORING_RSRC_FILE, &up, nr_args);
1142911429
}
1143011430

0 commit comments

Comments
 (0)