From: Herve Codina <herve.codina@bootlin.com>
To: jackysliu <1972843537@qq.com>
Cc: maz@kernel.org, tglx@linutronix.de, antonio.borneo@foss.st.com,
anup@brainfault.org, jirislaby@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] irqchip/gic-v3: fix resource leak in partition_domain_translate()
Date: Mon, 21 Jul 2025 10:10:15 +0200 [thread overview]
Message-ID: <20250721101015.1183e89b@bootlin.com> (raw)
In-Reply-To: <tencent_72EDAD7F6E52D8FB5933030A569A08AEC406@qq.com>
On Mon, 21 Jul 2025 15:28:04 +0800
jackysliu <1972843537@qq.com> wrote:
> There is a device node reference leak in partition_domain_translate().
> After the function obtains the device node np via of_find_node_by_phandle,
> it does not call of_node_put(np) to release the node reference
> in both the error path and the normal return path.
> This causes the node reference count to increase each time
> the function is called, causing a resource leak.
>
> This issue was detected by rule based static tools
> developed by Tencent.
>
> Fixes: 87228532e7e9 ("irqchip: Switch to of_fwnode_handle()")
>
> Signed-off-by: jackysliu <1972843537@qq.com>
> ---
> drivers/irqchip/irq-gic-v3.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index efc791c43d44..61c1d404b726 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -1821,12 +1821,16 @@ static int partition_domain_translate(struct irq_domain *d,
> return -EINVAL;
>
> ret = gic_irq_domain_translate(d, fwspec, &ppi_intid, type);
> - if (WARN_ON_ONCE(ret))
> + if (WARN_ON_ONCE(ret)) {
> + of_node_put(np);
> return 0;
> + }
>
> ppi_idx = __gic_get_ppi_index(ppi_intid);
> ret = partition_translate_id(gic_data.ppi_descs[ppi_idx],
> of_fwnode_handle(np));
> + of_node_put(np);
> +
> if (ret < 0)
> return ret;
>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
next prev parent reply other threads:[~2025-07-21 8:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 7:28 [PATCH] irqchip/gic-v3: fix resource leak in partition_domain_translate() jackysliu
2025-07-21 8:10 ` Herve Codina [this message]
2025-07-21 8:25 ` Marc Zyngier
2025-07-21 10:27 ` Jonathan Cameron
2025-07-21 10:45 ` Marc Zyngier
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=20250721101015.1183e89b@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=1972843537@qq.com \
--cc=antonio.borneo@foss.st.com \
--cc=anup@brainfault.org \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.