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-prev] [day] [month] [year] [list]
Message-ID: <CAL_JsqJdMy8h96crA2r66dHgrnQ9Rbm=g9i=hp9tZ5DLnbVpnA@mail.gmail.com>
Date: Fri, 3 Jan 2025 09:07:49 -0600
From: Rob Herring <robh@...nel.org>
To: Stephen Gordon <gordoste@...et.net.au>
Cc: Saravana Kannan <saravanak@...gle.com>, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] of: dynamic: Avoid reversing sibling order

On Thu, Jan 2, 2025 at 8:08 PM Stephen Gordon <gordoste@...et.net.au> wrote:
>
> On 3/01/2025 3:46 am, Rob Herring wrote:
>
> > The order should not be significant. What are the nodes where the order matters?
>
> The devicetree spec certainly doesn't make any guarantees of node order,
> so this is a reasonable question.
>
> The driver in question is using the of_graph_* functions with a tree like:
>
> ports {
>         p0: port@0 { reg = <0>; endpoint { }; };
>         p1: port@1 { reg = <1>; endpoint { }; };
>         p2: port@2 { reg = <2>; endpoint { }; };
> };

Well, this should be easy to fix. We have addresses, so we should
iterate in address order.

> The driver navigates to p0 using various graph functions, because it
> needs to process that before any other endpoint. It then uses
> of_graph_get_next_port_endpoint to iterate through the remaining
> endpoints. However, when the DT is created by dynamic.c, p0 is last and
> no further endpoints are returned.  If the tree is created by fdt.c or
> pdt.c, everything works fine, because the list of siblings is in the
> order they were specified in the file.

Can you just iterate by the index instead? We have functions which
return the specified port and/or endpoint number.

We can't really wholesale sort the child list to address order. While
that is the preferred source order as well, I'm sure there's something
somewhere depending on the order. The order can affect probe order
just like linking order does. However, I think we can safely change
the graph functions to guarantee address order. That means we need a
version of of_get_next_child() which guarantees it goes in address
order and then use that in the graph functions. It won't be efficient
since each iteration has to walk the whole list of children, but
there's never a lot of ports/endpoints.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ