* [PATCH] OF: base: fix infinite loop in of_find_matching_node_and_match
@ 2013-07-03 21:59 Sebastian Hesselbarth
0 siblings, 0 replies; only message in thread
From: Sebastian Hesselbarth @ 2013-07-03 21:59 UTC (permalink / raw)
To: Sebastian Hesselbarth; +Cc: barebox
of_find_matching_node_and_match macro can loop infinitely, because it
does not check for root node of the tree iterated over. This adds a
check for parent pointer of last tested iterator entry, which is
NULL for the root node.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Reported-by: Hiroki Nishimoto <hiroki.nishimoto.if@gmail.com>
---
Cc: barebox@lists.infradead.org
Cc: Hiroki Nishimoto <hiroki.nishimoto.if@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/of/base.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e9f1f79..f21476c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -418,6 +418,9 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
*match = m;
return np;
}
+ /* check for root node */
+ if (!np->parent)
+ break;
}
return NULL;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-07-03 22:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-03 21:59 [PATCH] OF: base: fix infinite loop in of_find_matching_node_and_match Sebastian Hesselbarth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox