From: Michael Ellerman <mpe@ellerman.id.au>
To: Solar Designer <solar@openwall.com>, oss-security@lists.openwall.com
Cc: 2639161967 <2639161967@qq.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Nicholas Piggin <npiggin@gmail.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [oss-security] Linux kernel: memory leak in arch/powerpc/platforms/powernv/opal-irqchip.c: opal_event_init()
Date: Fri, 06 Sep 2024 20:29:59 +1000 [thread overview]
Message-ID: <87wmjp3wig.fsf@mail.lhotse> (raw)
In-Reply-To: <20240902133435.GA29502@openwall.com>
Solar Designer <solar@openwall.com> writes:
> Hi,
>
> This bug report is misaddressed. Per upstream's preference and common
> sense (given how many issue reports there are against the Linux kernel),
> most Linux kernel (maybe-)issues should first be reported to Linux
> kernel maintainers/lists or (if you're reasonably sure of significant
> security relevance) to the Linux kernel security team, and only then (if
> relevant) maybe also to general security lists. Occasional exceptions
> exist, such as for publicly exploited issues, but if you're new to this
> chances are that you should play by the rules, not claim an exception.
This was also reported to security@kernel.org, and I replied saying
there was no real security impact and that it should be reported to
linuxppc-dev@lists.ozlabs.org.
> On Mon, Sep 02, 2024 at 09:54:52AM +0800, 2639161967 wrote:
>> in the newest linux release version, in /arch/powerpc/platforms/powernv/opal-irqchip.c file , the
>> opal_event_init function, the variable "name"defined in line 270, and is alloced memory in line 274 or 276, but not free, cause many times memory leak, and most old release versions have the problem.
>
> The code in question is:
>
> int __init opal_event_init(void)
> {
> [...]
> /* Install interrupt handlers */
> for (i = 0; i < opal_irq_count; i++) {
> struct resource *r = &opal_irqs[i];
> const char *name;
>
> /* Prefix name */
> if (r->name && strlen(r->name))
> name = kasprintf(GFP_KERNEL, "opal-%s", r->name);
> else
> name = kasprintf(GFP_KERNEL, "opal");
>
> if (!name)
> continue;
> /* Install interrupt handler */
> rc = request_irq(r->start, opal_interrupt, r->flags & IRQD_TRIGGER_MASK,
> name, NULL);
> if (rc) {
> pr_warn("Error %d requesting OPAL irq %d\n", rc, (int)r->start);
> continue;
> }
> }
...
>
> I'm CC'ing this to some maintainers in case they want to add to the "if
> (rc) {" block, if only to silence static analysis tools, but other than
> that I see nothing to do on this report.
If the request_irq() fails it's either some sort of firmware
misconfiguration, or ENOMEM, both which are possibly fatal to the
machine.
But still, it would be reasonable to kfree() name in the error path, as
you say if only to keep the static analysis clean.
Thanks for looking at it and sorry for the noise on your lists.
cheers
parent reply other threads:[~2024-09-06 10:30 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20240902133435.GA29502@openwall.com>]
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=87wmjp3wig.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=2639161967@qq.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=oss-security@lists.openwall.com \
--cc=solar@openwall.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).