Loading
drm/amd/display: Add null check for pipe_ctx->plane_state in dcn20_program_pipe
stable inclusion from stable-v6.11.3 commit 65a6fee22d5cfa645cb05489892dc9cd3d142fc2 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYRAY CVE: CVE-2024-49914 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=65a6fee22d5cfa645cb05489892dc9cd3d142fc2 -------------------------------- [ Upstream commit 8e4ed3cf1642df0c4456443d865cff61a9598aa8 ] This commit addresses a null pointer dereference issue in the `dcn20_program_pipe` function. The issue could occur when `pipe_ctx->plane_state` is null. The fix adds a check to ensure `pipe_ctx->plane_state` is not null before accessing. This prevents a null pointer dereference. Reported by smatch: drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn20/dcn20_hwseq.c:1925 dcn20_program_pipe() error: we previously assumed 'pipe_ctx->plane_state' could be null (see line 1877) Cc: Tom Chung <chiahsuan.chung@amd.com> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Cc: Roman Li <roman.li@amd.com> Cc: Alex Hung <alex.hung@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Hamza Mahfooz <hamza.mahfooz@amd.com> Signed-off-by:Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by:
Tom Chung <chiahsuan.chung@amd.com> Signed-off-by:
Alex Deucher <alexander.deucher@amd.com> Signed-off-by:
Sasha Levin <sashal@kernel.org> Conflicts: drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c [The stable version 5.10 is missing patch 65a6fee22d5cfa645cb05489892dc9cd3d142fc2, which was pulled from 6.11. Manually removed unnecessary code, such as if (pipe_ctx->update_flags.bits.det_size), if (hws->funcs.populate_mcm_luts), if (pipe_ctx->update_flags.bits.enable), if ((pipe_ctx->plane_state && pipe_ctx->plane_state->visible)). The purpose of this patch is to check if pipe_ctx->plane_state is not null before using its properties. Other extraneous code from higher versions is unrelated to the current patch and has been removed.] Signed-off-by:
Zicheng Qu <quzicheng@huawei.com>