]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clocksource: mtk: Fix race conditions in probe code
authorMatthias Brugger <matthias.bgg@gmail.com>
Thu, 19 Feb 2015 10:41:33 +0000 (11:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:53:04 +0000 (14:53 -0800)
commitdf1d6514e97391aa4e2459f6cf04d7f3be9b0faf
tree78a063baf8e6640419f77051cf6e6516260c345b
parent32effd19f64908551f8eff87e7975435edd16624
clocksource: mtk: Fix race conditions in probe code

commit d4a19eb3b15a4ba98f627182f48d5bc0cffae670 upstream.

We have two race conditions in the probe code which could lead to a null
pointer dereference in the interrupt handler.

The interrupt handler accesses the clockevent device, which may not yet be
registered.

First race condition happens when the interrupt handler gets registered before
the interrupts get disabled. The second race condition happens when the
interrupts get enabled, but the clockevent device is not yet registered.

Fix that by disabling the interrupts before we register the interrupt and enable
the interrupts after the clockevent device got registered.

Reported-by: Gongbae Park <yongbae2@gmail.com>
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/clocksource/mtk_timer.c