clocksource: Fix up a registration/IRQ race in the sh drivers.
authorPaul Mundt <lethal@linux-sh.org>
Thu, 25 Feb 2010 07:37:46 +0000 (16:37 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 15 Mar 2010 15:49:44 +0000 (08:49 -0700)
commitad10d8be3c5b7fce739d6b4c70ab712ac34d743a
tree87df95b16495f5b2e69627cc3d7ce1bf15ccfc63
parent34299ab10551905d26fc13166edc4d149ab497a9
clocksource: Fix up a registration/IRQ race in the sh drivers.

commit da64c2a8dee66ca03f4f3e15d84be7bedf73db3d upstream.

All of the SH clocksource drivers follow the scheme that the IRQ is setup
prior to registering the clockevent. The interrupt handler in the
clockevent cases looks to the event handler function pointer being filled
in by the registration code, permitting us to get in to situations where
asserted IRQs step in to the handler before registration has had a chance
to complete and hitting a NULL pointer deref.

In practice this is not an issue for most platforms, but some of them
with fairly special loaders (or that are chain-loading from another
kernel) may enter in to this situation. This fixes up the oops reported
by Rafael on hp6xx.

Reported-and-tested-by: Rafael Ignacio Zurita <rafaelignacio.zurita@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_mtu2.c
drivers/clocksource/sh_tmu.c