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)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 19 Nov 2014 09:43:51 +0000 (10:43 +0100)
commit6bab4a8a1888729f17f4923cc5867e4674f66333
tree95cf8a083e1799d3fabbf354ed40ac4bc599d19b
parent59aa896db80479dec29f471a7ca2b9eeeeb7d38e
clockevent: sun4i: Fix race condition in the probe code

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>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/sun4i_timer.c