diff options
| author | Zijun Hu <quic_zijuhu@quicinc.com> | 2025-02-09 20:58:58 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-25 10:43:45 +0200 |
| commit | 78d928bd6079f4c4973f9df91a676ddadf14a6e0 (patch) | |
| tree | 1d936f6e228788853a9aea93544ec59abdfe5d85 /drivers/of | |
| parent | b84b58ae4f36d62a9c7af439114c50833b3b408b (diff) | |
| download | linux-78d928bd6079f4c4973f9df91a676ddadf14a6e0.tar.gz linux-78d928bd6079f4c4973f9df91a676ddadf14a6e0.tar.bz2 linux-78d928bd6079f4c4973f9df91a676ddadf14a6e0.zip | |
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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/irq.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9d67dfa9b5f7..9cfa3e43e60d 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -503,8 +503,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; } |
