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>] [day] [month] [year] [list]
Message-Id: <20220615072407.3959470-1-windhl@126.com>
Date:   Wed, 15 Jun 2022 15:24:07 +0800
From:   heliang <windhl@....com>
To:     lpieralisi@...nel.org, pali@...nel.org
Cc:     linux-kernel@...r.kernel.org, windhl@....com
Subject: [PATCH] bus: mvebu-mbus: Add missing of_node_put in fail path

In mvebu_mbus_dt_init, of_find_matching_node_and_match() and
of_find_node_by_phandle() will return node pointer with refcounter
incremented. We should use of_node_put in fail path.

Signed-off-by: heliang <windhl@....com>
---
 drivers/bus/mvebu-mbus.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index db612045616f..7b16ede5097f 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -1327,22 +1327,28 @@ int __init mvebu_mbus_dt_init(bool is_coherent)
 
 	prop = of_get_property(np, "controller", NULL);
 	if (!prop) {
+		of_node_put(np);
 		pr_err("required 'controller' property missing\n");
 		return -EINVAL;
 	}
 
 	controller = of_find_node_by_phandle(be32_to_cpup(prop));
 	if (!controller) {
+		of_node_put(np);
 		pr_err("could not find an 'mbus-controller' node\n");
 		return -ENODEV;
 	}
 
 	if (of_address_to_resource(controller, 0, &mbuswins_res)) {
+		of_node_put(np);
+		of_node_put(controller);
 		pr_err("cannot get MBUS register address\n");
 		return -EINVAL;
 	}
 
 	if (of_address_to_resource(controller, 1, &sdramwins_res)) {
+		of_node_put(np);
+		of_node_put(controller);
 		pr_err("cannot get SDRAM register address\n");
 		return -EINVAL;
 	}
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ