Re: [PATCH AUTOSEL 6.1 13/22] proc/vmcore: fix potential memory leak in vmcore_init()

Andrew Morton
2022-12-18T00:32:33Z

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".