Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit deb5461d authored by Sultan Alsawaf's avatar Sultan Alsawaf Committed by Razziell
Browse files

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: default avatarSultan Alsawaf <sultanxda@gmail.com>

Signed-off-by: default avatarAlbert I <krascgq@outlook.co.id>

Signed-off-by: default avatarAlbert I <krascgq@outlook.co.id>
parent 48373d63
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment