[PATCH] HVC init race

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Nov 4 17:58:58 EST 2005


On Thu, 2005-11-03 at 23:10 -0600, Hollis Blanchard wrote:
> On Nov 3, 2005, at 11:02 PM, Michael Neuling wrote:
> 
> > I've been hitting a crash on boot where tty_open is being called 
> > before the
> > hvc console driver setup is complete.  Below patch fixes this problem.
> 
> What is the race exactly? I guess nothing should be calling into 
> hvc_open before tty_register_driver()...?

Well, in addition to the total lack of locking of the tty code you
mean ? :) Seriously, nothing protects tty_register_driver vs; concurrent
tty_open()...

The race we are hitting here is a bit different though, it is that
tty_open(), when asked for the default console driver, will first "ask"
the kernel console if it has a matching tty driver. It does that by
calling struct console -> device() callback.

The hvc implementation of this callback returns the global hvc_driver.
However, we fill that global before initializing it's content or
registering the tty... kaboom.

Ben.





More information about the Linuxppc64-dev mailing list