From: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
To: <saravanak@google.com>, <clement.leger@bootlin.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
<zajec5@gmail.com>, Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Marc Zyngier <maz@kernel.org>, <afaerber@suse.de>,
Manivannan Sadhasivam <mani@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Bjorn Helgaas <bhelgaas@google.com>, Nishanth Menon <nm@ti.com>,
<ssantosh@kernel.org>, <mathias.nyman@intel.com>,
<gregkh@linuxfoundation.org>, <thierry.reding@gmail.com>,
<jonathanh@nvidia.com>
Cc: devicetree@vger.kernel.org,
Jean-Jacques Hiblot <jjhiblot@traphandler.com>,
linux-actions@lists.infradead.org, linux-usb@vger.kernel.org,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-pci@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-sunxi@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] of: irq: release the node after looking up for "interrupts-extended"
Date: Wed, 1 Mar 2023 19:52:09 +0100 [thread overview]
Message-ID: <20230301185209.274134-4-jjhiblot@traphandler.com> (raw)
In-Reply-To: <20230301185209.274134-1-jjhiblot@traphandler.com>
When of_parse_phandle_with_args() succeeds, a get() is performed on
out_irq->np. And another get() is performed in of_irq_parse_raw(),
resulting in the refcount being incremented twice.
Fixing this by calling put() after of_irq_parse_raw().
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
drivers/of/irq.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 95da943fcf075..244f240bc4ac4 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -349,8 +349,12 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
/* Try the new-style interrupts-extended first */
res = of_parse_phandle_with_args(device, "interrupts-extended",
"#interrupt-cells", index, out_irq);
- if (!res)
- return of_irq_parse_raw(addr, out_irq);
+ if (!res) {
+ p = out_irq->np;
+ res = of_irq_parse_raw(addr, out_irq);
+ of_node_put(p);
+ return res;
+ }
/* Look for the interrupt parent. */
p = of_irq_find_parent(device);
--
2.25.1
next prev parent reply other threads:[~2023-03-02 4:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-01 18:52 [PATCH 0/3] of: irq: Fixes refcount issues with of_irq_parse_one()/of_irq_parse_raw() Jean-Jacques Hiblot
2023-03-01 18:52 ` [PATCH 1/3] of: irq: make callers of of_irq_parse_raw() release the device node Jean-Jacques Hiblot
2023-03-01 18:52 ` [PATCH 2/3] of: irq: make callers of of_irq_parse_one() " Jean-Jacques Hiblot
2023-03-02 7:49 ` Geert Uytterhoeven
2023-03-04 10:34 ` Jean-Jacques Hiblot
2023-03-04 14:47 ` Geert Uytterhoeven
2023-03-01 18:52 ` Jean-Jacques Hiblot [this message]
2023-03-01 21:00 ` [PATCH 3/3] of: irq: release the node after looking up for "interrupts-extended" Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230301185209.274134-4-jjhiblot@traphandler.com \
--to=jjhiblot@traphandler.com \
--cc=afaerber@suse.de \
--cc=bhelgaas@google.com \
--cc=christophe.leroy@csgroup.eu \
--cc=claudiu.beznea@microchip.com \
--cc=clement.leger@bootlin.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-actions@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=magnus.damm@gmail.com \
--cc=mani@kernel.org \
--cc=mathias.nyman@intel.com \
--cc=maz@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=nm@ti.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh+dt@kernel.org \
--cc=samuel@sholland.org \
--cc=saravanak@google.com \
--cc=ssantosh@kernel.org \
--cc=tglx@linutronix.de \
--cc=thierry.reding@gmail.com \
--cc=wens@csie.org \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).