* [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release()
@ 2025-12-19 7:42 ranxiaokai627
2025-12-19 8:41 ` Michal Hocko
2025-12-19 8:58 ` Vlastimil Babka
0 siblings, 2 replies; 3+ messages in thread
From: ranxiaokai627 @ 2025-12-19 7:42 UTC (permalink / raw)
To: akpm, vbabka, surenb, mhocko, jackmanb, hannes, ziy, elver,
andreyknvl, =osalvador
Cc: linux-kernel, linux-mm, ran.xiaokai, ranxiaokai627
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
The page_owner_stack_fops->open() callback invokes seq_open_private(),
therefore its corresponding ->release() callback must call seq_release_private().
Otherwise it will cause a memory leak of struct stack_print_ctx.
Fixes: 765973a098037 ("mm,page_owner: display all stacks and their count")
Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
mm/page_owner.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 27d19f01009c..b6a394a130ec 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -952,7 +952,7 @@ static const struct file_operations page_owner_stack_fops = {
.open = page_owner_stack_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release,
+ .release = seq_release_private,
};
static int page_owner_threshold_get(void *data, u64 *val)
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release()
2025-12-19 7:42 [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release() ranxiaokai627
@ 2025-12-19 8:41 ` Michal Hocko
2025-12-19 8:58 ` Vlastimil Babka
1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2025-12-19 8:41 UTC (permalink / raw)
To: ranxiaokai627
Cc: akpm, vbabka, surenb, jackmanb, hannes, ziy, elver, andreyknvl,
=osalvador, linux-kernel, linux-mm, ran.xiaokai
On Fri 19-12-25 07:42:32, ranxiaokai627@163.com wrote:
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
>
> The page_owner_stack_fops->open() callback invokes seq_open_private(),
> therefore its corresponding ->release() callback must call seq_release_private().
> Otherwise it will cause a memory leak of struct stack_print_ctx.
>
> Fixes: 765973a098037 ("mm,page_owner: display all stacks and their count")
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
> ---
> mm/page_owner.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 27d19f01009c..b6a394a130ec 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -952,7 +952,7 @@ static const struct file_operations page_owner_stack_fops = {
> .open = page_owner_stack_open,
> .read = seq_read,
> .llseek = seq_lseek,
> - .release = seq_release,
> + .release = seq_release_private,
> };
>
> static int page_owner_threshold_get(void *data, u64 *val)
> --
> 2.25.1
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release()
2025-12-19 7:42 [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release() ranxiaokai627
2025-12-19 8:41 ` Michal Hocko
@ 2025-12-19 8:58 ` Vlastimil Babka
1 sibling, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2025-12-19 8:58 UTC (permalink / raw)
To: ranxiaokai627, akpm, surenb, mhocko, jackmanb, hannes, ziy,
elver, andreyknvl, =osalvador
Cc: linux-kernel, linux-mm, ran.xiaokai
On 12/19/25 08:42, ranxiaokai627@163.com wrote:
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
>
> The page_owner_stack_fops->open() callback invokes seq_open_private(),
> therefore its corresponding ->release() callback must call seq_release_private().
> Otherwise it will cause a memory leak of struct stack_print_ctx.
>
> Fixes: 765973a098037 ("mm,page_owner: display all stacks and their count")
I think cc: stable is warranted, Andrew can add it if he agrees.
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Thanks!
> ---
> mm/page_owner.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 27d19f01009c..b6a394a130ec 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -952,7 +952,7 @@ static const struct file_operations page_owner_stack_fops = {
> .open = page_owner_stack_open,
> .read = seq_read,
> .llseek = seq_lseek,
> - .release = seq_release,
> + .release = seq_release_private,
> };
>
> static int page_owner_threshold_get(void *data, u64 *val)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-19 8:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 7:42 [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release() ranxiaokai627
2025-12-19 8:41 ` Michal Hocko
2025-12-19 8:58 ` Vlastimil Babka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox