aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2015-08-19 13:17:47 -0700
committerSasha Levin <sasha.levin@oracle.com>2015-10-27 22:14:51 -0400
commitbe2a16239713fcaa5c0479c5cb0821cdba59fc81 (patch)
tree5d0dc1c52b81e032daa0877b9e38511559d40aaa
parent825cc9616f9b826bb700973b58ae7affa3da5748 (diff)
of/address: Don't loop forever in of_find_matching_node_by_address().
[ Upstream commit 3a496b00b6f90c41bd21a410871dfc97d4f3c7ab ] If the internal call to of_address_to_resource() fails, we end up looping forever in of_find_matching_node_by_address(). This can be caused by a defective device tree, or calling with an incorrect matches argument. Fix by calling of_find_matching_node() unconditionally at the end of the loop. Signed-off-by: David Daney <david.daney@cavium.com> Cc: stable@vger.kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--drivers/of/address.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 1dba1a9c1fcf..9e77614391a0 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -845,10 +845,10 @@ struct device_node *of_find_matching_node_by_address(struct device_node *from,
struct resource res;
while (dn) {
- if (of_address_to_resource(dn, 0, &res))
- continue;
- if (res.start == base_address)
+ if (!of_address_to_resource(dn, 0, &res) &&
+ res.start == base_address)
return dn;
+
dn = of_find_matching_node(dn, matches);
}