Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Fix null check for pipe_ctx->plane_state in resource_build_scaling_params

Null pointer dereference 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.

Found by code review.

Fixes: 3be5262e353b ("drm/amd/display: Rename more dc_surface stuff to plane_state")
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 63e6a77ccf239337baa9b1e7787cde9fa0462092)
Cc: stable@vger.kernel.org

authored by

Ma Ke and committed by
Alex Deucher
374c9faa 7eb17214

+2 -1
+2 -1
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1455 1455 DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger); 1456 1456 1457 1457 /* Invalid input */ 1458 - if (!plane_state->dst_rect.width || 1458 + if (!plane_state || 1459 + !plane_state->dst_rect.width || 1459 1460 !plane_state->dst_rect.height || 1460 1461 !plane_state->src_rect.width || 1461 1462 !plane_state->src_rect.height) {