[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241209-of_irq_fix-v1-8-782f1419c8a1@quicinc.com>
Date: Mon, 09 Dec 2024 21:25:06 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, Marc Zyngier <maz@...nel.org>,
Stefan Wiehler <stefan.wiehler@...ia.com>,
Grant Likely <grant.likely@...aro.org>, Tony Lindgren <tony@...mide.com>,
Kumar Gala <galak@...eaurora.org>,
Thierry Reding <thierry.reding@...il.com>,
Julia Lawall <Julia.Lawall@...6.fr>, Jamie Iles <jamie@...ieiles.com>,
Grant Likely <grant.likely@...retlab.ca>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Rob Herring <rob.herring@...xeda.com>,
Zijun Hu <quic_zijuhu@...cinc.com>, stable@...r.kernel.org
Subject: [PATCH 8/8] of/irq: Fix device node refcount leakage in API
irq_of_parse_and_map()
From: Zijun Hu <quic_zijuhu@...cinc.com>
In irq_of_parse_and_map(), refcount of device node @oirq.np was got
by successful of_irq_parse_one() invocation, but it does not put the
refcount before return, so causes @oirq.np refcount leakage.
Fix by putting @oirq.np refcount before return.
Fixes: e3873444990d ("of/irq: Move irq_of_parse_and_map() to common code")
Cc: stable@...r.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/of/irq.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 29a58d62d97d1ca4d09a4e4d21531b5b9b958494..b43c49de935c76cbf1e49391517dd7b1a569b7fa 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -38,11 +38,15 @@
unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
{
struct of_phandle_args oirq;
+ unsigned int ret;
if (of_irq_parse_one(dev, index, &oirq))
return 0;
- return irq_create_of_mapping(&oirq);
+ ret = irq_create_of_mapping(&oirq);
+ of_node_put(oirq.np);
+
+ return ret;
}
EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
--
2.34.1
Powered by blists - more mailing lists