]> Gentwo Git Trees - linux/.git/commitdiff
io_uring: move flags check to io_uring_sanitise_params
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 10 Nov 2025 13:04:52 +0000 (13:04 +0000)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Nov 2025 14:53:33 +0000 (07:53 -0700)
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>
io_uring/io_uring.c

index af7b4cbe98501e0921f97bae24f9cda1f56de748..7e069d56b8a13a1f5b20756d52e650b3d32247c7 100644 (file)
@@ -3430,6 +3430,9 @@ static int io_uring_sanitise_params(struct io_uring_params *p)
 {
        unsigned flags = p->flags;
 
+       if (flags & ~IORING_SETUP_FLAGS)
+               return -EINVAL;
+
        /* There is no way to mmap rings without a real fd */
        if ((flags & IORING_SETUP_REGISTERED_FD_ONLY) &&
            !(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)))
                return -EINVAL;
 
-       if (p.flags & ~IORING_SETUP_FLAGS)
-               return -EINVAL;
        p.sq_entries = entries;
        return io_uring_create(&p, params);
 }