msm: mdss: Fix occasional panic on init due to race in DSI status driver
The hw_vsync_handler IRQ handler is registered in a different driver,
so it can fire before mdss_dsi_status_init() finishes. The race that can
occur happens after the global variable pstatus_data is initialized and
before the check_status delayed work is initialized:
mdss_dsi_status_init() hw_vsync_handler()
--------------------------------------------------------------
pstatus_data = kzalloc(...)
IRQ received; function entry
if (pstatus_data) -> evaluates to true
mod_delayed_work() called
KERNEL PANIC!
INIT_DELAYED_WORK() called
--------------------------------------------------------------
When mod_delayed_work() is called using an uninitialized work struct, the
kernel crashes due to a null pointer dereference.
Fix the panic on init by adding an init lock and being more careful with
the global pointer variable (pstatus_data).
Change-Id: Ifc06f6e4f795daa29bc7a5e63aba26c2cf7d3fc3
Signed-off-by:
Sultan Alsawaf <sultanxda@gmail.com>
Signed-off-by:
Albert I <krascgq@outlook.co.id>
Signed-off-by:
Albert I <krascgq@outlook.co.id>
Loading
Please register or sign in to comment