Skip to content

Commit a76a5ae

Browse files
ranxiaokaiakpm00
authored andcommitted
mm/page_owner: fix memory leak in page_owner_stack_fops->release()
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: 765973a ("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>
1 parent 077d925 commit a76a5ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/page_owner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ static const struct file_operations page_owner_stack_fops = {
952952
.open = page_owner_stack_open,
953953
.read = seq_read,
954954
.llseek = seq_lseek,
955-
.release = seq_release,
955+
.release = seq_release_private,
956956
};
957957

958958
static int page_owner_threshold_get(void *data, u64 *val)

0 commit comments

Comments
 (0)