• Matthias Brugger's avatar
    clocksource: mtk: Fix race conditions in probe code · d4a19eb3
    Matthias Brugger authored
    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: default avatarGongbae Park <yongbae2@gmail.com>
    Signed-off-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
    d4a19eb3
mtk_timer.c 6.83 KB