[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240925113641.1297102-154-sashal@kernel.org>
Date: Wed, 25 Sep 2024 07:26:15 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Srinivasan Shanmugam <srinivasan.shanmugam@....com>,
Tom Chung <chiahsuan.chung@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
Roman Li <roman.li@....com>,
Alex Hung <alex.hung@....com>,
Aurabindo Pillai <aurabindo.pillai@....com>,
Harry Wentland <harry.wentland@....com>,
Hamza Mahfooz <hamza.mahfooz@....com>,
Alex Deucher <alexander.deucher@....com>,
Sasha Levin <sashal@...nel.org>,
sunpeng.li@....com,
christian.koenig@....com,
Xinhui.Pan@....com,
airlied@...il.com,
daniel@...ll.ch,
alvin.lee2@....com,
samson.tam@....com,
wenjing.liu@....com,
dillon.varone@....com,
ilya.bakoulin@....com,
amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org
Subject: [PATCH AUTOSEL 6.11 154/244] drm/amd/display: Add NULL check for function pointer in dcn32_set_output_transfer_func
From: Srinivasan Shanmugam <srinivasan.shanmugam@....com>
[ Upstream commit 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@....com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@....com>
Cc: Roman Li <roman.li@....com>
Cc: Alex Hung <alex.hung@....com>
Cc: Aurabindo Pillai <aurabindo.pillai@....com>
Cc: Harry Wentland <harry.wentland@....com>
Cc: Hamza Mahfooz <hamza.mahfooz@....com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@....com>
Reviewed-by: Tom Chung <chiahsuan.chung@....com>
Signed-off-by: Alex Deucher <alexander.deucher@....com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
index 39fd3f58886c5..f4d05c984b298 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
@@ -582,7 +582,9 @@ bool dcn32_set_output_transfer_func(struct dc *dc,
}
}
- mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
+ if (mpc->funcs->set_output_gamma)
+ mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
+
return ret;
}
--
2.43.0
Powered by blists - more mailing lists