]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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:57:19 +0000 (15:57 -0800)
commit391d9c6c3beef96ce3080487cdd158cd4e9711e6
treea21c737c63687f2a5f545b20dec8da0205cda03c
parentb1abe707d14ef7d7557f9b671d9709941cd4810a
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