of/irq: Fix device node refcount leakages in of_irq_count()
commitbbf71f44aaupstream. 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:3da5278727("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bd8f172195
commit
52f0888eff
+3
-1
@@ -443,8 +443,10 @@ int of_irq_count(struct device_node *dev)
|
||||
struct of_phandle_args irq;
|
||||
int nr = 0;
|
||||
|
||||
while (of_irq_parse_one(dev, nr, &irq) == 0)
|
||||
while (of_irq_parse_one(dev, nr, &irq) == 0) {
|
||||
of_node_put(irq.np);
|
||||
nr++;
|
||||
}
|
||||
|
||||
return nr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user