[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <337ee90a6464e9b9ab09d1850fd9aedcb0e13679.1764264798.git.asml.silence@gmail.com>
Date: Thu, 27 Nov 2025 20:44:14 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: netdev@...r.kernel.org
Cc: "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jonathan Corbet <corbet@....net>,
Michael Chan <michael.chan@...adcom.com>,
Pavan Chebbi <pavan.chebbi@...adcom.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Pavel Begunkov <asml.silence@...il.com>,
Jens Axboe <axboe@...nel.dk>,
Simon Horman <horms@...nel.org>,
linux-doc@...r.kernel.org,
linux-kselftest@...r.kernel.org,
io-uring@...r.kernel.org,
dtatulea@...dia.com,
Stanislav Fomichev <stfomichev@...il.com>,
Mina Almasry <almasrymina@...gle.com>
Subject: [PATCH net-next v6 1/8] net: page_pool: sanitise allocation order
We're going to give more control over rx buffer sizes to user space, and
since we can't always rely on driver validation, let's sanitise it in
page_pool_init() as well. Note that we only need to reject over
MAX_PAGE_ORDER allocations for normal page pools, as current memory
providers don't need to use the buddy allocator and must check the order
on init.i
Suggested-by: Stanislav Fomichev <stfomichev@...il.com>
Reviewed-by: Mina Almasry <almasrymina@...gle.com>
Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
---
net/core/page_pool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 1a5edec485f1..635c77e8050b 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -301,6 +301,9 @@ static int page_pool_init(struct page_pool *pool,
}
static_branch_inc(&page_pool_mem_providers);
+ } else if (pool->p.order > MAX_PAGE_ORDER) {
+ err = -EINVAL;
+ goto free_ptr_ring;
}
return 0;
--
2.52.0
Powered by blists - more mailing lists