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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 5 Jun 2020 09:54:59 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Jordan Hand <jorhand@...ux.microsoft.com>
Cc:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        linux-kernel@...r.kernel.org, linux-next@...r.kernel.org
Subject: Re: [PATCH] software node: recursively unregister child swnodes

On Thu, Jun 04, 2020 at 01:57:01PM -0700, Jordan Hand wrote:
> On 6/4/20 1:15 PM, Greg Kroah-Hartman wrote:
> > On Thu, Jun 04, 2020 at 12:36:23PM -0700, jorhand@...ux.microsoft.com wrote:
> > > From: Jordan Hand <jorhand@...ux.microsoft.com>
> > > 
> > > If a child swnode is unregistered after it's parent, it can lead to
> > > undefined behavior.
> > 
> > Crashing the system is not really "undefined" :)
> 
> Fair point :)
> 
> > 
> > > When a swnode is unregistered, recursively free it's children to avoid
> > > this condition.
> > 
> > Are you sure?  Why would you be unregistering a child after it's parent?
> > Why not just do not do that?
> > 
> 
> The main motivation for doing this was to support
> `software_node_unregister_nodes` so that the passed list of nodes does not
> need to be ordered in any particular way.
> 
> I suppose another way to do this would be to add a new function
> `fwnode_remove_software_node_recursive` and just call that from
> `software_node_unregister_nodes`.
> 
> That said, I suppose just ordering the nodes so that children come before
> parents would also be fine. My thinking was just that accepting any node
> ordering is simpler.

Right now, the way the driver model and sysfs/kobjects work is that all
objects must be removed in child-first order.  The problem of your
change where you want to try to remove the devices in parent-first order
is that you do not really know if you still have a reference to a child
device somewhere else, which would prevent this all from happening
correctly, right?

So if you "know" it is safe to drop a child, that's great, and expected.
Don't work to make  this one tiny user of the kobjects (which I'm still
not quite sure why they are kobjects and not devices), do things in a
different way from the rest of the kernel without a strong reason to do
so.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ