Skip to content

Commit 59b519b

Browse files
zijun-hujfvogel
authored andcommitted
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: e387344 ("of/irq: Move irq_of_parse_and_map() to common code") Cc: [email protected] Signed-off-by: Zijun Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit d0f25a99770f761deea9c26f818c4c171fe71afc) Signed-off-by: Jack Vogel <[email protected]>
1 parent 95cef83 commit 59b519b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/of/irq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@
3939
unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
4040
{
4141
struct of_phandle_args oirq;
42+
unsigned int ret;
4243

4344
if (of_irq_parse_one(dev, index, &oirq))
4445
return 0;
4546

46-
return irq_create_of_mapping(&oirq);
47+
ret = irq_create_of_mapping(&oirq);
48+
of_node_put(oirq.np);
49+
50+
return ret;
4751
}
4852
EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
4953

0 commit comments

Comments
 (0)