clockevent: sun4i: Fix race condition in the probe code
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Tue, 18 Nov 2014 22:59:33 +0000 (23:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2014 23:55:34 +0000 (15:55 -0800)
commit09c5db4f301e49dfe70afc8401d3f15c2cfecd68
treece6e44859acf372472f5997a47d09bb544dbab04
parent2c120e85dea7358d2255cf68b2fd2b666077c768
clockevent: sun4i: Fix race condition in the probe code

commit 6bab4a8a1888729f17f4923cc5867e4674f66333 upstream.

The interrupts were activated and the handler registered before the clockevent
was registered in the probe function.

The interrupt handler, however, was making the assumption that the clockevent
device was registered.

That could cause a null pointer dereference if the timer interrupt was firing
during this narrow window.

Fix that by moving the clockevent registration before the interrupt is enabled.

Reported-by: Roman Byshko <rbyshko@gmail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/clocksource/sun4i_timer.c