All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: ranxiaokai627@163.com
Cc: akpm@linux-foundation.org, vbabka@suse.cz, surenb@google.com,
	jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com,
	elver@google.com, andreyknvl@gmail.com, =osalvador@suse.de,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	ran.xiaokai@zte.com.cn
Subject: Re: [PATCH] mm/page_owner: fix memory leak in page_owner_stack_fops->release()
Date: Fri, 19 Dec 2025 09:41:08 +0100	[thread overview]
Message-ID: <aUUPpBDSfq82Wdlh@tiehlicka> (raw)
In-Reply-To: <20251219074232.136482-1-ranxiaokai627@163.com>

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


  reply	other threads:[~2025-12-19  8:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-12-19  8:58 ` Vlastimil Babka

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=aUUPpBDSfq82Wdlh@tiehlicka \
    --to=mhocko@suse.com \
    --cc==osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=elver@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=ranxiaokai627@163.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.