]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Fix null check for pipe_ctx->plane_state in resource_build_scaling_p...
authorMa Ke <make24@iscas.ac.cn>
Wed, 26 Feb 2025 08:37:31 +0000 (16:37 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Mar 2025 16:44:53 +0000 (11:44 -0500)
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
drivers/gpu/drm/amd/display/dc/core/dc_resource.c

index 520a34a42827b1417918918b34599b1d27a73e5e..a45037cb4cc01b1e79cc218834784495bcf13ce8 100644 (file)
@@ -1455,7 +1455,8 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
        DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
 
        /* Invalid input */
-       if (!plane_state->dst_rect.width ||
+       if (!plane_state ||
+                       !plane_state->dst_rect.width ||
                        !plane_state->dst_rect.height ||
                        !plane_state->src_rect.width ||
                        !plane_state->src_rect.height) {