提交 09466fdd 编写于 作者: X Xia Fukun 提交者: openeuler-sync-bot

drm/msm/dpu: Add check for pstates

stable inclusion
from stable-v5.10.173
commit e9743b3052e125c44b555f07f2876a4bdccfd983
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I7F2UT
CVE: CVE-2023-3220

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e9743b3052e125c44b555f07f2876a4bdccfd983

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

[ Upstream commit 93340e10 ]

As kzalloc may fail and return NULL pointer,
it should be better to check pstates
in order to avoid the NULL pointer dereference.

Fixes: 25fdd593 ("drm/msm: Add SDM845 DPU support")
Signed-off-by: NJiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: NAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/514160/
Link: https://lore.kernel.org/r/20221206080236.43687-1-jiasheng@iscas.ac.cnSigned-off-by: NDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NXia Fukun <xiafukun@huawei.com>
(cherry picked from commit 72096ab0)
上级 77a2f577
...@@ -831,6 +831,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, ...@@ -831,6 +831,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_rect crtc_rect = { 0 }; struct drm_rect crtc_rect = { 0 };
pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL); pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
if (!pstates)
return -ENOMEM;
if (!state->enable || !state->active) { if (!state->enable || !state->active) {
DPU_DEBUG("crtc%d -> enable %d, active %d, skip atomic_check\n", DPU_DEBUG("crtc%d -> enable %d, active %d, skip atomic_check\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册