Skip to content

Commit 95cef83

Browse files
zijun-hujfvogel
authored andcommitted
of/irq: Fix device node refcount leakages in of_irq_count()
commit bbf71f44aaf241d853759a71de7e7ebcdb89be3d upstream. of_irq_count() invokes of_irq_parse_one() to count IRQs, and successful invocation of the later will get device node @irq.np refcount, but the former does not put the refcount before next iteration invocation, hence causes device node refcount leakages. Fix by putting @irq.np refcount before the next iteration invocation. Fixes: 3da5278 ("of/irq: Rework of_irq_count()") 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 29cb94963ca9dce389e02047199db2f7cfaaa23e) Signed-off-by: Jack Vogel <[email protected]>
1 parent 8e29b0b commit 95cef83

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/of/irq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,10 @@ int of_irq_count(struct device_node *dev)
508508
struct of_phandle_args irq;
509509
int nr = 0;
510510

511-
while (of_irq_parse_one(dev, nr, &irq) == 0)
511+
while (of_irq_parse_one(dev, nr, &irq) == 0) {
512+
of_node_put(irq.np);
512513
nr++;
514+
}
513515

514516
return nr;
515517
}

0 commit comments

Comments
 (0)