[PATCH 1/3] OF: base: fix infinite loop in of_find_node_by_name

Sascha Hauer s.hauer at pengutronix.de
Fri Jul 5 02:50:43 EDT 2013


Hi Sebastian,

On Thu, Jul 04, 2013 at 07:12:10PM +0200, Sebastian Hesselbarth wrote:
> On 07/04/13 08:58, Sascha Hauer wrote:
> >On Thu, Jul 04, 2013 at 12:46:16AM +0200, Sebastian Hesselbarth wrote:
> >>of_find_node_by_name suffers from infinite looping, 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.
> >>
> >
> >How about the following which adds the check to the iterator instead of
> >repeating it in the users.
> 
> Sascha,
> 
> I have taken your patch and successfully tested it for all node
> iterators.

I applied this one.

> of_for_each_node_with_property requires an additional patch
> to initialize an empty from node with root_node.
> 
> Also, there was a similar issue for the child iterator where I sent a
> patch ("OF: base: fix iterator in of_get_next_available_child") tonight.

I applied this one aswell.

What's missing now is the mentioned fix for
of_for_each_node_with_property, then we should be fine.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list