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]
Message-ID: <Pine.LNX.4.44L0.1110141229450.2036-100000@iolanthe.rowland.org>
Date:	Fri, 14 Oct 2011 12:33:31 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Grant Likely <grant.likely@...retlab.ca>
cc:	Ming Lei <tom.leiming@...il.com>,
	Andrei Warkentin <awarkentin@...are.com>,
	Greg KH <greg@...ah.com>, Dilan Lee <dilee@...dia.com>,
	"G, Manjunath Kondaiah" <manjugk@...com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	<linux-mmc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	Josh Triplett <josh@...htriplett.org>, <Manjunath@...per.es>,
	<linux-omap@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	Linux PM List <linux-pm@...r.kernel.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: [PATCH 2/5] drivercore: Add driver probe deferral mechanism

On Fri, 14 Oct 2011, Grant Likely wrote:

> > How can a device acquire children before it has a driver?
> 
> There are a few potential situations in embedded systems (or at least
> nothing currently prevents it) where platform setup code constructs a
> device hierarchy without the aid of device drivers, and it is still
> possible for a parent device to be attached to a driver.  IIUC, SPARC
> creates an entire hierarchy of platform_devices from all the nodes in
> the OpenFirmware device tree, and any of those devices can be bound to
> a driver.  I don't like that approach, but at the very least it needs
> to be guarded against.

Do these devices ever require deferred probes?

> On Fri, Oct 14, 2011 at 9:39 AM, Alan Stern <stern@...land.harvard.edu> wrote:
> > On Thu, 13 Oct 2011, Grant Likely wrote:
> >> I saw those.  I also notice that they are only used by device_move()
> >> when reparenting a device (which is another wrinkle I hadn't though
> >> about).  Reparenting a device becomes problematic if the probe order
> >> is also represented in the list.  If device_move() gets called, then
> >> any implicit probe-order sorting for that device would be lost.
> >>
> >> I also notice that device_move disregards any children when moving a
> >> device, which could also be a problem.
> >>
> >> Although it looks like the only users of device_move are:
> >>
> >> drivers/media/video/pvrusb2/pvrusb2-v4l2.c
> >> drivers/s390/cio/device.c
> >> net/bluetooth/hci_sysfs.c
> >> net/bluetooth/rfcomm/tty.c
> >>
> >> So it may not be significant to adapt.
> >
> > I trust that very little will be needed.  I haven't checked the
> > existing callers, but it's reasonable to require that a device being
> > moved not have any children.
> 
> Yes, that does indeed simplify the issue considerably.  Let's do that.
>  So, for this patch, there will be two bits added.  First, don't allow
> deferral on devices with children, and second a successful probe
> (deferred or otherwise) should always move a device to the end of the
> dap_list if it doesn't have children to guarantee that the list order
> satisfies both the hierarchical and probe order.  Manjunath, do you
> think you can prototype this?

I don't think the second part needs to be quite so invasive.  
Certainly drivers that never defer probes shouldn't require anything to
be moved.

A deferred probe _should_ move the device to the end of the list.  But
this needs to happen in the probe routine itself (after it has verified
that all the other required devices are present and before it has
registered any children) to prevent races.  It can't be done in a
central location.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ