diff options
| author | Zijun Hu <quic_zijuhu@quicinc.com> | 2025-02-09 20:58:59 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-20 10:18:25 +0200 |
| commit | 044b5cc971c1c981e5d3db3c76700c077ac2230b (patch) | |
| tree | 02b092d349323b1ef4298377993b91562aad6496 | |
| parent | 5b61a04fbb5cdf59003d28f8bc77552f62c18f71 (diff) | |
of/irq: Fix device node refcount leakage in API irq_of_parse_and_map()
commit 962a2805e47b933876ba0e4c488d9e89ced2dd29 upstream.
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@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-6-93e3a2659aa7@quicinc.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/of/irq.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 6f5d924b82e4..d06222d7f515 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -39,11 +39,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); |
