diff options
author | Jian Shen <shenjian15@huawei.com> | 2023-10-30 17:12:56 +0800 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-11-02 12:27:53 +0100 |
commit | 8ffbd1669ed1d58939d6e878dffaa2f60bf961a4 (patch) | |
tree | 06fb52a85d9484cb0598d315fd62f08e44ef111d /net/core | |
parent | f55d8e60f10909dbc5524e261041e1d28d7d20d8 (diff) | |
download | linux-8ffbd1669ed1d58939d6e878dffaa2f60bf961a4.tar.gz linux-8ffbd1669ed1d58939d6e878dffaa2f60bf961a4.tar.bz2 linux-8ffbd1669ed1d58939d6e878dffaa2f60bf961a4.zip |
net: page_pool: add missing free_percpu when page_pool_init fail
When ptr_ring_init() returns failure in page_pool_init(), free_percpu()
is not called to free pool->recycle_stats, which may cause memory
leak.
Fixes: ad6fa1e1ab1b ("page_pool: Add recycle stats")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Link: https://lore.kernel.org/r/20231030091256.2915394-1-shaojijie@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/page_pool.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 5e409b98aba0..dec544337236 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -217,8 +217,12 @@ static int page_pool_init(struct page_pool *pool, return -ENOMEM; #endif - if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) + if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) { +#ifdef CONFIG_PAGE_POOL_STATS + free_percpu(pool->recycle_stats); +#endif return -ENOMEM; + } atomic_set(&pool->pages_state_release_cnt, 0); |