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-next>] [day] [month] [year] [list]
Date:   Tue, 10 Dec 2019 02:14:53 -0600
From:   frowand.list@...il.com
To:     Rob Herring <robh+dt@...nel.org>
Cc:     devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] of: refcount leak when phandle_cache entry replaced

From: Frank Rowand <frank.rowand@...y.com>

of_find_node_by_phandle() does not do an of_node_put() of the existing
node in a phandle cache entry when that node is replaced by a new node.

Reported-by: Rob Herring <robh+dt@...nel.org>
Fixes: b8a9ac1a5b99 ("of: of_node_get()/of_node_put() nodes held in phandle cache")
Signed-off-by: Frank Rowand <frank.rowand@...y.com>
---

Checkpatch will warn about a line over 80 characters.  Let me know
if that bothers you.

 drivers/of/base.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index db7fbc0c0893..b57a57752294 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1261,6 +1261,8 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 			if (np->phandle == handle &&
 			    !of_node_check_flag(np, OF_DETACHED)) {
 				if (phandle_cache) {
+					if (phandle_cache[masked_handle])
+						of_node_put(phandle_cache[masked_handle]);
 					/* will put when removed from cache */
 					of_node_get(np);
 					phandle_cache[masked_handle] = np;
-- 
Frank Rowand <frank.rowand@...y.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ