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:	Mon, 20 Jan 2014 15:51:28 -0800
From:	Greg KH <gregkh@...uxfoundation.org>
To:	Russell King - ARM Linux <linux@....linux.org.uk>
Cc:	Tushar Behera <tushar.behera@...aro.org>,
	linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
	linux-samsung-soc@...r.kernel.org, jslaby@...e.cz,
	ben.dooks@...ethink.co.uk, broonie@...nel.org
Subject: Re: [PATCH 1/2] serial: samsung: Move uart_register_driver call to
 device probe

On Mon, Jan 20, 2014 at 11:16:03PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 20, 2014 at 03:11:41PM -0800, Greg KH wrote:
> > On Mon, Jan 20, 2014 at 09:32:06PM +0000, Russell King - ARM Linux wrote:
> > > On Mon, Jan 20, 2014 at 01:16:01PM -0800, Greg KH wrote:
> > > > On Mon, Jan 20, 2014 at 10:05:30AM +0000, Russell King - ARM Linux wrote:
> > > > > On Mon, Jan 20, 2014 at 02:32:34PM +0530, Tushar Behera wrote:
> > > > > > uart_register_driver call binds the driver to a specific device
> > > > > > node through tty_register_driver call. This should typically happen
> > > > > > during device probe call.
> > > > > > 
> > > > > > In a multiplatform scenario, it is possible that multiple serial
> > > > > > drivers are part of the kernel. Currently the driver registration fails
> > > > > > if multiple serial drivers with same default major/minor numbers are
> > > > > > included in the kernel.
> > > > > > 
> > > > > > A typical case is observed with amba-pl011 and samsung-uart drivers.
> > > > > 
> > > > > The samsung-uart driver is at fault here - the major/minor numbers were
> > > > > officially registered to amba-pl011.  Samsung needs to be fixed properly.
> > > > 
> > > > I agree, the Samsung driver is "broken" here, but that's no reason why
> > > > these two drivers can't register with the tty layer _after_ the hardware
> > > > is detected, and not before.
> > > > 
> > > > That saves resources on systems that build the drivers in, yet do not
> > > > have the hardware present, which is always a good thing.
> > > 
> > > Great, so what you're saying is that we need to wait until the first
> > > device calls into the probe function.  What about removal... how does
> > > a driver know when it's last device has been removed to de-register
> > > that?
> > 
> > The "bus" that the device is on handles that, right?
> > 
> > > I guess it needs the driver model to provide some way to know when a
> > > driver is completely unbound - but isn't that racy?
> > 
> > How is it racy?  That's how the driver model works...
> 
> Think about what happens when the last device unregisters, but a new
> device comes along and is probed.
> 
> I don't believe the driver model has any locking to prevent a drivers
> ->probe function running concurrently with it's ->remove function for
> two (or more) devices.

The bus prevents this from happening.

> The locking against this is done on a per-device basis, not a per-driver
> basis.

No, on a per-bus basis.

thanks,

greg k-h
--
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