]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
fb705fb2f045a239413941cc8daec908f6236c94
[thirdparty/kernel/stable-queue.git] /
1 From 62ed6f0f198da04e884062264df308277628004f Mon Sep 17 00:00:00 2001
2 From: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
3 Date: Wed, 31 Jul 2024 13:09:28 +0530
4 Subject: drm/amd/display: Add NULL check for function pointer in dcn20_set_output_transfer_func
5
6 From: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
7
8 commit 62ed6f0f198da04e884062264df308277628004f upstream.
9
10 This commit adds a null check for the set_output_gamma function pointer
11 in the dcn20_set_output_transfer_func function. Previously,
12 set_output_gamma was being checked for null at line 1030, but then it
13 was being dereferenced without any null check at line 1048. This could
14 potentially lead to a null pointer dereference error if set_output_gamma
15 is null.
16
17 To fix this, we now ensure that set_output_gamma is not null before
18 dereferencing it. We do this by adding a null check for set_output_gamma
19 before the call to set_output_gamma at line 1048.
20
21 Cc: Tom Chung <chiahsuan.chung@amd.com>
22 Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
23 Cc: Roman Li <roman.li@amd.com>
24 Cc: Alex Hung <alex.hung@amd.com>
25 Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
26 Cc: Harry Wentland <harry.wentland@amd.com>
27 Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
28 Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
29 Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
30 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
31 Signed-off-by: Sasha Levin <sashal@kernel.org>
32 Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34 ---
35 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 ++-
36 1 file changed, 2 insertions(+), 1 deletion(-)
37
38 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
39 +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
40 @@ -856,7 +856,8 @@ bool dcn20_set_output_transfer_func(stru
41 /*
42 * if above if is not executed then 'params' equal to 0 and set in bypass
43 */
44 - mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
45 + if (mpc->funcs->set_output_gamma)
46 + mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
47
48 return true;
49 }