]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mm/page_owner: fix memory leak in page_owner_stack_fops->release()
authorRan Xiaokai <ran.xiaokai@zte.com.cn>
Fri, 19 Dec 2025 07:42:32 +0000 (07:42 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 23 Dec 2025 19:23:17 +0000 (11:23 -0800)
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.

Link: https://lkml.kernel.org/r/20251219074232.136482-1-ranxiaokai627@163.com
Fixes: 765973a09803 ("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>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Marco Elver <elver@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_owner.c

index a702456842061b4be7b4c7a45d8431e8745b7ef6..b3260f0c17ba4f75a630aeadb03e4ca4dd09cbc9 100644 (file)
@@ -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)