Commit a7c51a95 authored by Douglas Anderson's avatar Douglas Anderson Committed by Tomasz Nowicki
Browse files

FROMLIST: drm/msm: Avoid NULL dereference in msm_disp_state_print_regs()



If the allocation in msm_disp_state_dump_regs() failed then
`block->state` can be NULL. The msm_disp_state_print_regs() function
_does_ have code to try to handle it with:

  if (*reg)
    dump_addr = *reg;

...but since "dump_addr" is initialized to NULL the above is actually
a noop. The code then goes on to dereference `dump_addr`.

Make the function print "Registers not stored" when it sees a NULL to
solve this. Since we're touching the code, fix
msm_disp_state_print_regs() not to pointlessly take a double-pointer
and properly mark the pointer as `const`.

Fixes: 98659487 ("drm/msm: add support to take dpu snapshot")
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
(am from https://patchwork.kernel.org/patch/13835318/)
(also found at https://lore.kernel.org/r/20241014093605.1.Ia1217cecec9ef09eb3c6d125360cc6c8574b0e73@changeid)

UPSTREAM-TASK=b:374146921
BUG=b:372769248, b:372926092
TEST=With test patch force memory alloc to fail and force a dpu core dump

Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5941458


Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarRob Clark <robdclark@chromium.org>
Reviewed-by: default avatarSean Paul <sean@poorly.run>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Change-Id: I5ce81f8f0bbe070204dc7f5a6db1f48d6732807b
Signed-off-by: default avatarHubert Mazur <hmazur@google.com>
Signed-off-by: default avatarTomasz Nowicki <tnowicki@google.com>
parent d69dec69
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment