]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
9fcd6ab450e455b1ca31f5142c7424c7f1848509
[thirdparty/kernel/stable-queue.git] /
1 From 374c9faac5a763a05bc3f68ad9f73dab3c6aec90 Mon Sep 17 00:00:00 2001
2 From: Ma Ke <make24@iscas.ac.cn>
3 Date: Wed, 26 Feb 2025 16:37:31 +0800
4 Subject: drm/amd/display: Fix null check for pipe_ctx->plane_state in resource_build_scaling_params
5
6 From: Ma Ke <make24@iscas.ac.cn>
7
8 commit 374c9faac5a763a05bc3f68ad9f73dab3c6aec90 upstream.
9
10 Null pointer dereference issue could occur when pipe_ctx->plane_state
11 is null. The fix adds a check to ensure 'pipe_ctx->plane_state' is not
12 null before accessing. This prevents a null pointer dereference.
13
14 Found by code review.
15
16 Fixes: 3be5262e353b ("drm/amd/display: Rename more dc_surface stuff to plane_state")
17 Reviewed-by: Alex Hung <alex.hung@amd.com>
18 Signed-off-by: Ma Ke <make24@iscas.ac.cn>
19 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
20 (cherry picked from commit 63e6a77ccf239337baa9b1e7787cde9fa0462092)
21 Cc: stable@vger.kernel.org
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 ---
24 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 ++-
25 1 file changed, 2 insertions(+), 1 deletion(-)
26
27 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
28 +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
29 @@ -1394,7 +1394,8 @@ bool resource_build_scaling_params(struc
30 DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
31
32 /* Invalid input */
33 - if (!plane_state->dst_rect.width ||
34 + if (!plane_state ||
35 + !plane_state->dst_rect.width ||
36 !plane_state->dst_rect.height ||
37 !plane_state->src_rect.width ||
38 !plane_state->src_rect.height) {