lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241209-of_irq_fix-v1-5-782f1419c8a1@quicinc.com>
Date: Mon, 09 Dec 2024 21:25:03 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, 
 Lorenzo Pieralisi <lpieralisi@...nel.org>, 
 Bjorn Helgaas <bhelgaas@...gle.com>, Marc Zyngier <maz@...nel.org>, 
 Stefan Wiehler <stefan.wiehler@...ia.com>, 
 Grant Likely <grant.likely@...aro.org>, Tony Lindgren <tony@...mide.com>, 
 Kumar Gala <galak@...eaurora.org>, 
 Thierry Reding <thierry.reding@...il.com>, 
 Julia Lawall <Julia.Lawall@...6.fr>, Jamie Iles <jamie@...ieiles.com>, 
 Grant Likely <grant.likely@...retlab.ca>, 
 Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org, 
 linux-kernel@...r.kernel.org, Rob Herring <rob.herring@...xeda.com>, 
 Zijun Hu <quic_zijuhu@...cinc.com>, stable@...r.kernel.org
Subject: [PATCH 5/8] of/irq: Fix device node refcount leakage in API
 of_irq_parse_one()

From: Zijun Hu <quic_zijuhu@...cinc.com>

For of_irq_parse_one(), refcount of device node @out_irq->np was got by
successful of_parse_phandle_with_args() invocation, but it does not put
the refcount before return, so causes the device node refcount leakage.

Fix by putting the node's refcount before return as the other branch does.

Fixes: 79d9701559a9 ("of/irq: create interrupts-extended property")
Cc: stable@...r.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 drivers/of/irq.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 64c005dfa23bd157d891f3f10526327deb5e2cfa..e5a9e24a5bd3606a57a07d0d12d3e774e9c78977 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -373,8 +373,11 @@ 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_buf, out_irq);
+	if (!res) {
+		p = out_irq->np;
+		res = of_irq_parse_raw(addr_buf, out_irq);
+		goto out;
+	}
 
 	/* Look for the interrupt parent. */
 	p = of_irq_find_parent(device);

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ