From: Fuad Tabba <fuad.tabba@linux.dev>
To: Rob Herring <robh@kernel.org>, Saravana Kannan <saravanak@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>, Will Deacon <will@kernel.org>,
Fuad Tabba <tabba@google.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] of/irq: Fix device node refcount leak in of_irq_get_affinity()
Date: Wed, 26 Aug 2026 12:22:34 +0100 [thread overview]
Message-ID: <20260826112234.1033974-1-fuad.tabba@linux.dev> (raw)
of_irq_parse_one() raises the refcount of the interrupt controller node
on success, and of_irq_get_affinity() returns without putting it, so
every call past the parse leaks one reference. It is reached from
platform_get_irq_affinity(), used by arm_pmu, arm_spe_pmu and
coresight-trbe.
Put it once irq_populate_fwspec_info() has run: no in-tree
->get_fwspec_info() returns a mask that lives in the node.
Fixes: 5404f5c06dd4 ("of/irq: Add interrupt affinity reporting interface")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
drivers/of/irq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 967c191008797..ec035367c9500 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -563,7 +563,9 @@ const struct cpumask *of_irq_get_affinity(struct device_node *dev, int index)
of_phandle_args_to_fwspec(oirq.np, oirq.args, oirq.args_count,
&fwspec);
- if (irq_populate_fwspec_info(&fwspec, &info))
+ rc = irq_populate_fwspec_info(&fwspec, &info);
+ of_node_put(oirq.np);
+ if (rc)
return NULL;
return info.affinity;
base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f
--
2.39.5
next reply other threads:[~2026-08-26 11:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 11:22 Fuad Tabba [this message]
2026-08-26 14:49 ` Rob Herring (Arm)
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=20260826112234.1033974-1-fuad.tabba@linux.dev \
--to=fuad.tabba@linux.dev \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
--cc=tabba@google.com \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®