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>pull/1354/merge
parent
01405895c1
commit
712fbe97c3
|
|
@ -3430,6 +3430,9 @@ static int io_uring_sanitise_params(struct io_uring_params *p)
|
||||||
{
|
{
|
||||||
unsigned flags = p->flags;
|
unsigned flags = p->flags;
|
||||||
|
|
||||||
|
if (flags & ~IORING_SETUP_FLAGS)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* There is no way to mmap rings without a real fd */
|
/* There is no way to mmap rings without a real fd */
|
||||||
if ((flags & IORING_SETUP_REGISTERED_FD_ONLY) &&
|
if ((flags & IORING_SETUP_REGISTERED_FD_ONLY) &&
|
||||||
!(flags & IORING_SETUP_NO_MMAP))
|
!(flags & IORING_SETUP_NO_MMAP))
|
||||||
|
|
@ -3691,8 +3694,6 @@ static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
|
||||||
if (!mem_is_zero(&p.resv, sizeof(p.resv)))
|
if (!mem_is_zero(&p.resv, sizeof(p.resv)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (p.flags & ~IORING_SETUP_FLAGS)
|
|
||||||
return -EINVAL;
|
|
||||||
p.sq_entries = entries;
|
p.sq_entries = entries;
|
||||||
return io_uring_create(&p, params);
|
return io_uring_create(&p, params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue