]> git.baikalelectronics.ru Git - kernel.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)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 25 Feb 2015 09:28:49 +0000 (10:28 +0100)
commita0c9da380fccb399b2cdfcef566fce4e108a208c
treeba55b0edb3f786383a00f7700906ea455e141075
parente665d26e05a683e363a4e2835da6b8f0fae4ebea
clocksource: mtk: Fix race conditions in probe code

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