* [PATCH AUTOSEL 6.1 13/22] proc/vmcore: fix potential memory leak in vmcore_init() [not found] <20221217152727.98061-1-sashal@kernel.org> @ 2022-12-17 15:27 ` Sasha Levin 2022-12-18 0:32 ` Andrew Morton 0 siblings, 1 reply; 3+ messages in thread From: Sasha Levin @ 2022-12-17 15:27 UTC (permalink / raw) To: linux-kernel, stable Cc: Jianglei Nie, Baoquan He, Benjamin Herrenschmidt, Chen Lifu, Eric W . Biederman, Li Chen, Michael Ellerman, Paul Mackerras, Petr Mladek, Russell King, ye xingchen, Zeal Robot, Andrew Morton, Sasha Levin, kexec, linux-fsdevel From: Jianglei Nie <niejianglei2021@163.com> [ Upstream commit 12b9d301ff73122aebd78548fa4c04ca69ed78fe ] Patch series "Some minor cleanup patches resent". The first three patches trivial clean up patches. And for the patch "kexec: replace crash_mem_range with range", I got a ibm-p9wr ppc64le system to test, it works well. This patch (of 4): elfcorehdr_alloc() allocates a memory chunk for elfcorehdr_addr with kzalloc(). If is_vmcore_usable() returns false, elfcorehdr_addr is a predefined value. If parse_crash_elf_headers() gets some error and returns a negetive value, the elfcorehdr_addr should be released with elfcorehdr_free(). Fix it by calling elfcorehdr_free() when parse_crash_elf_headers() fails. Link: https://lkml.kernel.org/r/20220929042936.22012-1-bhe@redhat.com Link: https://lkml.kernel.org/r/20220929042936.22012-2-bhe@redhat.com Signed-off-by: Jianglei Nie <niejianglei2021@163.com> Signed-off-by: Baoquan He <bhe@redhat.com> Acked-by: Baoquan He <bhe@redhat.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Chen Lifu <chenlifu@huawei.com> Cc: "Eric W . Biederman" <ebiederm@xmission.com> Cc: Li Chen <lchen@ambarella.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Paul Mackerras <paulus@samba.org> Cc: Petr Mladek <pmladek@suse.com> Cc: Russell King <linux@armlinux.org.uk> Cc: ye xingchen <ye.xingchen@zte.com.cn> Cc: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- fs/proc/vmcore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index f2aa86c421f2..74747571d58e 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -1567,6 +1567,7 @@ static int __init vmcore_init(void) return rc; rc = parse_crash_elf_headers(); if (rc) { + elfcorehdr_free(elfcorehdr_addr); pr_warn("Kdump: vmcore not initialized\n"); return rc; } -- 2.35.1 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 6.1 13/22] proc/vmcore: fix potential memory leak in vmcore_init() 2022-12-17 15:27 ` [PATCH AUTOSEL 6.1 13/22] proc/vmcore: fix potential memory leak in vmcore_init() Sasha Levin @ 2022-12-18 0:32 ` Andrew Morton 2022-12-18 11:28 ` Sasha Levin 0 siblings, 1 reply; 3+ messages in thread From: Andrew Morton @ 2022-12-18 0:32 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, stable, Jianglei Nie, Baoquan He, Benjamin Herrenschmidt, Chen Lifu, Eric W . Biederman, Li Chen, Michael Ellerman, Paul Mackerras, Petr Mladek, Russell King, ye xingchen, Zeal Robot, kexec, linux-fsdevel, Greg Kroah-Hartman On Sat, 17 Dec 2022 10:27:14 -0500 Sasha Levin <sashal@kernel.org> wrote: > From: Jianglei Nie <niejianglei2021@163.com> > > [ Upstream commit 12b9d301ff73122aebd78548fa4c04ca69ed78fe ] > > Patch series "Some minor cleanup patches resent". > > The first three patches trivial clean up patches. > > And for the patch "kexec: replace crash_mem_range with range", I got a > ibm-p9wr ppc64le system to test, it works well. > > This patch (of 4): > > elfcorehdr_alloc() allocates a memory chunk for elfcorehdr_addr with > kzalloc(). If is_vmcore_usable() returns false, elfcorehdr_addr is a > predefined value. If parse_crash_elf_headers() gets some error and > returns a negetive value, the elfcorehdr_addr should be released with > elfcorehdr_free(). This is exceedingly minor - a single memory leak per boot, under very rare circumstances. With every patch I merge I consider -stable. Often I'll discuss the desirability of a backport with the author and with reviewers. Every single patch. And then some damn script comes along and overrides that quite careful decision. argh. Can we please do something like if (akpm && !cc:stable) dont_backport() And even go further - if your script thinks it might be something we should backport and if it didn't have cc:stable then contact the author, reviewers and committers and ask them to reconsider before we go and backport it. This approach will have the advantage of training people to consider the backport more consistently. I'd (still) like to have a new patch tag like Not-For-Stable: or cc:not-stable or something to tell your scripts "yes, we thought about it and we decided no". _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 6.1 13/22] proc/vmcore: fix potential memory leak in vmcore_init() 2022-12-18 0:32 ` Andrew Morton @ 2022-12-18 11:28 ` Sasha Levin 0 siblings, 0 replies; 3+ messages in thread From: Sasha Levin @ 2022-12-18 11:28 UTC (permalink / raw) To: Andrew Morton Cc: linux-kernel, stable, Jianglei Nie, Baoquan He, Benjamin Herrenschmidt, Chen Lifu, Eric W . Biederman, Li Chen, Michael Ellerman, Paul Mackerras, Petr Mladek, Russell King, ye xingchen, Zeal Robot, kexec, linux-fsdevel, Greg Kroah-Hartman On Sat, Dec 17, 2022 at 04:32:28PM -0800, Andrew Morton wrote: >On Sat, 17 Dec 2022 10:27:14 -0500 Sasha Levin <sashal@kernel.org> wrote: > >> From: Jianglei Nie <niejianglei2021@163.com> >> >> [ Upstream commit 12b9d301ff73122aebd78548fa4c04ca69ed78fe ] >> >> Patch series "Some minor cleanup patches resent". >> >> The first three patches trivial clean up patches. >> >> And for the patch "kexec: replace crash_mem_range with range", I got a >> ibm-p9wr ppc64le system to test, it works well. >> >> This patch (of 4): >> >> elfcorehdr_alloc() allocates a memory chunk for elfcorehdr_addr with >> kzalloc(). If is_vmcore_usable() returns false, elfcorehdr_addr is a >> predefined value. If parse_crash_elf_headers() gets some error and >> returns a negetive value, the elfcorehdr_addr should be released with >> elfcorehdr_free(). > >This is exceedingly minor - a single memory leak per boot, under very >rare circumstances. > > >With every patch I merge I consider -stable. Often I'll discuss the >desirability of a backport with the author and with reviewers. Every >single patch. And then some damn script comes along and overrides that >quite careful decision. argh. > >Can we please do something like > > if (akpm && !cc:stable) > dont_backport() Yup, I already had it set for 'akpm && mm/ && !cc:stable', happy to remove the 'mm/' restriction if you're doing the same for the rest of the patches you review. >And even go further - if your script thinks it might be something we >should backport and if it didn't have cc:stable then contact the >author, reviewers and committers and ask them to reconsider before we >go and backport it. This approach will have the advantage of training >people to consider the backport more consistently. This is what this mail is all about: I haven't queued up the patch yet, it gives folks week+ to review, and all it takes is a simple "no" for me to drop it. >I'd (still) like to have a new patch tag like Not-For-Stable: or >cc:not-stable or something to tell your scripts "yes, we thought about >it and we decided no". No objections on my part. -- Thanks, Sasha _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-18 11:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221217152727.98061-1-sashal@kernel.org>
2022-12-17 15:27 ` [PATCH AUTOSEL 6.1 13/22] proc/vmcore: fix potential memory leak in vmcore_init() Sasha Levin
2022-12-18 0:32 ` Andrew Morton
2022-12-18 11:28 ` Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox