From: Yunsheng Lin <linyunsheng@huawei.com>
To: Jijie Shao <shaojijie@huawei.com>, <hawk@kernel.org>,
<ilias.apalodimas@linaro.org>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<jdamato@fastly.com>
Cc: <shenjian15@huawei.com>, <wangjie125@huawei.com>,
<liuyonglong@huawei.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: page_pool: add missing free_percpu when page_pool_init fail
Date: Mon, 30 Oct 2023 17:31:26 +0800 [thread overview]
Message-ID: <aca292af-025c-6034-29bf-cac7404effe2@huawei.com> (raw)
In-Reply-To: <20231030091256.2915394-1-shaojijie@huawei.com>
On 2023/10/30 17:12, Jijie Shao wrote:
> From: Jian Shen <shenjian15@huawei.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@huawei.com>
>
> Fixes: ad6fa1e1ab1b ("page_pool: Add recycle stats")
> Signed-off-by: Jian Shen <shenjian15@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.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);
>
>
next prev parent reply other threads:[~2023-10-30 9:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 9:12 [PATCH net] net: page_pool: add missing free_percpu when page_pool_init fail Jijie Shao
2023-10-30 9:31 ` Yunsheng Lin [this message]
2023-10-30 12:07 ` Jiri Pirko
2023-10-30 13:44 ` Somnath Kotur
2023-11-01 11:11 ` Ilias Apalodimas
2023-11-02 11:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aca292af-025c-6034-29bf-cac7404effe2@huawei.com \
--to=linyunsheng@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=jdamato@fastly.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=wangjie125@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox