Commit f5bc2063 authored by Srinivasan Shanmugam's avatar Srinivasan Shanmugam Committed by Xiongfeng Wang
Browse files

drm/amd/display: Add NULL check for function pointer in dcn32_set_output_transfer_func

mainline inclusion
from mainline-v6.12-rc1
commit 28574b08c70e56d34d6f6379326a860b96749051
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYRCD
CVE: CVE-2024-49909

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=28574b08c70e56d34d6f6379326a860b96749051



--------------------------------

This commit adds a null check for the set_output_gamma function pointer
in the dcn32_set_output_transfer_func function. Previously,
set_output_gamma was being checked for null, but then it was being
dereferenced without any null check. This could lead to a null pointer
dereference if set_output_gamma is null.

To fix this, we now ensure that set_output_gamma is not null before
dereferencing it. We do this by adding a null check for set_output_gamma
before the call to set_output_gamma.

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: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: default avatarTom Chung <chiahsuan.chung@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>

Conflicts:
	drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
	drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
[wangxiongfeng: fix conflicts because the file is renamed]
Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
parent d9d4eb85
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -587,7 +587,9 @@ bool dcn32_set_output_transfer_func(struct dc *dc,
		}
	}

	if (mpc->funcs->set_output_gamma)
		mpc->funcs->set_output_gamma(mpc, mpcc_id, params);

	return ret;
}