Skip to content

Commit 712fbe9

Browse files
isilenceaxboe
authored andcommitted
io_uring: move flags check to io_uring_sanitise_params
io_uring_sanitise_params() sanitises most of the setup flags invariants, move the IORING_SETUP_FLAGS check from io_uring_setup() into it. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 0140589 commit 712fbe9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

io_uring/io_uring.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,6 +3430,9 @@ static int io_uring_sanitise_params(struct io_uring_params *p)
34303430
{
34313431
unsigned flags = p->flags;
34323432

3433+
if (flags & ~IORING_SETUP_FLAGS)
3434+
return -EINVAL;
3435+
34333436
/* There is no way to mmap rings without a real fd */
34343437
if ((flags & IORING_SETUP_REGISTERED_FD_ONLY) &&
34353438
!(flags & IORING_SETUP_NO_MMAP))
@@ -3691,8 +3694,6 @@ static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
36913694
if (!mem_is_zero(&p.resv, sizeof(p.resv)))
36923695
return -EINVAL;
36933696

3694-
if (p.flags & ~IORING_SETUP_FLAGS)
3695-
return -EINVAL;
36963697
p.sq_entries = entries;
36973698
return io_uring_create(&p, params);
36983699
}

0 commit comments

Comments
 (0)