lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aca292af-025c-6034-29bf-cac7404effe2@huawei.com>
Date: Mon, 30 Oct 2023 17:31:26 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Jijie Shao <shaojijie@...wei.com>, <hawk@...nel.org>,
	<ilias.apalodimas@...aro.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <jdamato@...tly.com>
CC: <shenjian15@...wei.com>, <wangjie125@...wei.com>,
	<liuyonglong@...wei.com>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] net: page_pool: add missing free_percpu when
 page_pool_init fail

On 2023/10/30 17:12, Jijie Shao wrote:
> From: Jian Shen <shenjian15@...wei.com>
> 
> 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.

LGTM.
Reviewed-by: Yunsheng Lin <linyunsheng@...wei.com>

> 
> Fixes: ad6fa1e1ab1b ("page_pool: Add recycle stats")
> Signed-off-by: Jian Shen <shenjian15@...wei.com>
> Signed-off-by: Jijie Shao <shaojijie@...wei.com>
> ---
>  net/core/page_pool.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 77cb75e63aca..31f923e7b5c4 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -221,8 +221,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);
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ