Skip to content

Commit 9954464

Browse files
isilencekuba-moo
authored andcommitted
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 <[email protected]> Reviewed-by: Mina Almasry <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Link: https://patch.msgid.link/77ad83c1aec66cbd00e7b3952f74bc3b7a988150.1764542851.git.asml.silence@gmail.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8548588 commit 9954464

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/core/page_pool.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ static int page_pool_init(struct page_pool *pool,
301301
}
302302

303303
static_branch_inc(&page_pool_mem_providers);
304+
} else if (pool->p.order > MAX_PAGE_ORDER) {
305+
err = -EINVAL;
306+
goto free_ptr_ring;
304307
}
305308

306309
return 0;

0 commit comments

Comments
 (0)