Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of/irq: Fix device node refcount leakage in API irq_of_parse_and_map()

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>

authored by

Zijun Hu and committed by
Rob Herring (Arm)
962a2805 bbf71f44

+5 -1
+5 -1
drivers/of/irq.c
··· 39 39 unsigned int irq_of_parse_and_map(struct device_node *dev, int index) 40 40 { 41 41 struct of_phandle_args oirq; 42 + unsigned int ret; 42 43 43 44 if (of_irq_parse_one(dev, index, &oirq)) 44 45 return 0; 45 46 46 - return irq_create_of_mapping(&oirq); 47 + ret = irq_create_of_mapping(&oirq); 48 + of_node_put(oirq.np); 49 + 50 + return ret; 47 51 } 48 52 EXPORT_SYMBOL_GPL(irq_of_parse_and_map); 49 53