Commit 9954464d authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jakub Kicinski
Browse files

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: default avatarStanislav Fomichev <stfomichev@gmail.com>
Reviewed-by: default avatarMina Almasry <almasrymina@google.com>
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/77ad83c1aec66cbd00e7b3952f74bc3b7a988150.1764542851.git.asml.silence@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 85485884
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;