summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-11-10 13:04:52 +0000
committerJens Axboe <axboe@kernel.dk>2025-11-11 07:53:33 -0700
commit712fbe97c3322cb7a6ae1112e67a680e7ff1b206 (patch)
tree7338808157d39b4f50977b37f556cec9c36a3aef
parent01405895c1e7d950964bebc8e4b0fc7aa77de24c (diff)
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>
-rw-r--r--io_uring/io_uring.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index af7b4cbe9850..7e069d56b8a1 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -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);
}