From: Greg Kroah-Hartman Date: Wed, 6 Nov 2024 08:07:14 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v4.19.323~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc2cad66e0f3fed4bfdff91fefa63cd298b6f7e0;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: drm-amd-display-add-null-checks-for-stream-and-plane-before-dereferencing.patch --- diff --git a/queue-6.1/drm-amd-display-add-null-checks-for-stream-and-plane-before-dereferencing.patch b/queue-6.1/drm-amd-display-add-null-checks-for-stream-and-plane-before-dereferencing.patch new file mode 100644 index 00000000000..248df4227fd --- /dev/null +++ b/queue-6.1/drm-amd-display-add-null-checks-for-stream-and-plane-before-dereferencing.patch @@ -0,0 +1,53 @@ +From 15c2990e0f0108b9c3752d7072a97d45d4283aea Mon Sep 17 00:00:00 2001 +From: Srinivasan Shanmugam +Date: Mon, 27 May 2024 20:15:21 +0530 +Subject: drm/amd/display: Add null checks for 'stream' and 'plane' before dereferencing + +From: Srinivasan Shanmugam + +commit 15c2990e0f0108b9c3752d7072a97d45d4283aea upstream. + +This commit adds null checks for the 'stream' and 'plane' variables in +the dcn30_apply_idle_power_optimizations function. These variables were +previously assumed to be null at line 922, but they were used later in +the code without checking if they were null. This could potentially lead +to a null pointer dereference, which would cause a crash. + +The null checks ensure that 'stream' and 'plane' are not null before +they are used, preventing potential crashes. + +Fixes the below static smatch checker: +drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:938 dcn30_apply_idle_power_optimizations() error: we previously assumed 'stream' could be null (see line 922) +drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:940 dcn30_apply_idle_power_optimizations() error: we previously assumed 'plane' could be null (see line 922) + +Cc: Tom Chung +Cc: Nicholas Kazlauskas +Cc: Bhawanpreet Lakha +Cc: Rodrigo Siqueira +Cc: Roman Li +Cc: Hersen Wu +Cc: Alex Hung +Cc: Aurabindo Pillai +Cc: Harry Wentland +Signed-off-by: Srinivasan Shanmugam +Reviewed-by: Aurabindo Pillai +Signed-off-by: Alex Deucher +[Xiangyu: Modified file path to backport this commit] +Signed-off-by: Xiangyu Chen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +@@ -762,6 +762,9 @@ bool dcn30_apply_idle_power_optimization + stream = dc->current_state->streams[0]; + plane = (stream ? dc->current_state->stream_status[0].plane_states[0] : NULL); + ++ if (!stream || !plane) ++ return false; ++ + if (stream && plane) { + cursor_cache_enable = stream->cursor_position.enable && + plane->address.grph.cursor_cache_addr.quad_part; diff --git a/queue-6.1/series b/queue-6.1/series index 2010b2af13f..fa124595e25 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -119,3 +119,4 @@ wifi-iwlwifi-mvm-fix-6-ghz-scan-construction.patch mm-shmem-fix-data-race-in-shmem_getattr.patch loongarch-fix-build-errors-due-to-backported-timens.patch mtd-spi-nor-winbond-fix-w25q128-regression.patch +drm-amd-display-add-null-checks-for-stream-and-plane-before-dereferencing.patch