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 leakages in of_irq_count()

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: 3da5278727a8 ("of/irq: Rework of_irq_count()")
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-5-93e3a2659aa7@quicinc.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Zijun Hu and committed by
Rob Herring (Arm)
bbf71f44 ff93e721

+3 -1
+3 -1
drivers/of/irq.c
··· 508 508 struct of_phandle_args irq; 509 509 int nr = 0; 510 510 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); 512 513 nr++; 514 + } 513 515 514 516 return nr; 515 517 }