提交 d866d032 编写于 作者: J Jonathan Marek 提交者: Wang ShaoBo

drm/msm/a6xx: avoid shadow NULL reference in failure path

stable inclusion
from stable-v5.10.44
commit fd681a8c7ac8f649a0718f6cbf2fe75d0587c9a2
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=472
CVE: NA

-------------------------------------------------

commit ce86c239 upstream.

If a6xx_hw_init() fails before creating the shadow_bo, the a6xx_pm_suspend
code referencing it will crash. Change the condition to one that avoids
this problem (note: creation of shadow_bo is behind this same condition)

Fixes: e8b0b994 ("drm/msm/a6xx: Clear shadow on suspend")
Signed-off-by: NJonathan Marek <jonathan@marek.ca>
Reviewed-by: NAkhil P Oommen <akhilpo@codeaurora.org>
Link: https://lore.kernel.org/r/20210513171431.18632-6-jonathan@marek.caSigned-off-by: NRob Clark <robdclark@chromium.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Nlzb <zbliancs@qq.com>
Reviewed-by: NJian Cheng <cj.chengjian@huawei.com>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 0462a9a8
...@@ -1055,7 +1055,7 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) ...@@ -1055,7 +1055,7 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu)
if (ret) if (ret)
return ret; return ret;
if (adreno_gpu->base.hw_apriv || a6xx_gpu->has_whereami) if (a6xx_gpu->shadow_bo)
for (i = 0; i < gpu->nr_rings; i++) for (i = 0; i < gpu->nr_rings; i++)
a6xx_gpu->shadow[i] = 0; a6xx_gpu->shadow[i] = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册