From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
Tom Chung <chiahsuan.chung@amd.com>,
Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
Roman Li <roman.li@amd.com>, Alex Hung <alex.hung@amd.com>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Harry Wentland <harry.wentland@amd.com>,
Hamza Mahfooz <hamza.mahfooz@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Sasha Levin <sashal@kernel.org>,
sunpeng.li@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com,
airlied@gmail.com, daniel@ffwll.ch, harikrishna.revalla@amd.com,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 6.11 186/244] drm/amd/display: Fix index out of bounds in DCN30 degamma hardware format translation
Date: Wed, 25 Sep 2024 07:26:47 -0400 [thread overview]
Message-ID: <20240925113641.1297102-186-sashal@kernel.org> (raw)
In-Reply-To: <20240925113641.1297102-1-sashal@kernel.org>
From: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
[ Upstream commit bc50b614d59990747dd5aeced9ec22f9258991ff ]
This commit addresses a potential index out of bounds issue in the
`cm3_helper_translate_curve_to_degamma_hw_format` function in the DCN30
color management module. The issue could occur when the index 'i'
exceeds the number of transfer function points (TRANSFER_FUNC_POINTS).
The fix adds a check to ensure 'i' is within bounds before accessing the
transfer function points. If 'i' is out of bounds, the function returns
false to indicate an error.
Reported by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_cm_common.c:338 cm3_helper_translate_curve_to_degamma_hw_format() error: buffer overflow 'output_tf->tf_pts.red' 1025 <= s32max
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_cm_common.c:339 cm3_helper_translate_curve_to_degamma_hw_format() error: buffer overflow 'output_tf->tf_pts.green' 1025 <= s32max
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_cm_common.c:340 cm3_helper_translate_curve_to_degamma_hw_format() error: buffer overflow 'output_tf->tf_pts.blue' 1025 <= s32max
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: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
index b8327237ed441..edc77615d0973 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
@@ -335,6 +335,8 @@ bool cm3_helper_translate_curve_to_degamma_hw_format(
i += increment) {
if (j == hw_points - 1)
break;
+ if (i >= TRANSFER_FUNC_POINTS)
+ return false;
rgb_resulted[j].red = output_tf->tf_pts.red[i];
rgb_resulted[j].green = output_tf->tf_pts.green[i];
rgb_resulted[j].blue = output_tf->tf_pts.blue[i];
--
2.43.0
next prev parent reply other threads:[~2024-09-25 11:49 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240925113641.1297102-1-sashal@kernel.org>
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 130/244] drm/amd/display: Pass non-null to dcn20_validate_apply_pipe_split_flags Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 131/244] drm/amd/display: Check null pointers before using them Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 132/244] drm/amd/display: Check null pointers before used Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 133/244] drm/amd/display: Check null pointers before multiple uses Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 134/244] drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 135/244] drm/amdkfd: amdkfd_free_gtt_mem clear the correct pointer Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 136/244] drm/amd/display: Add null check for head_pipe in dcn201_acquire_free_pipe_for_layer Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 137/244] drm/amd/display: Add null check for head_pipe in dcn32_acquire_idle_pipe_for_head_pipe_in_layer Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 138/244] drm/amd/display: Add NULL check for clk_mgr and clk_mgr->funcs in dcn30_init_hw Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 139/244] drm/amd/display: Add NULL check for clk_mgr and clk_mgr->funcs in dcn401_init_hw Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 140/244] drm/amd/display: Add NULL check for clk_mgr in dcn32_init_hw Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 142/244] drm/amd/display: Add null check for pipe_ctx->plane_state in dcn20_program_pipe Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 143/244] drm/amd/display: Add null check for top_pipe_to_program in commit_planes_for_stream Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 144/244] drm/amd/display: Use gpuvm_min_page_size_kbytes for DML2 surfaces Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 150/244] drm/amd/display: Underflow Seen on DCN401 eGPU Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 151/244] drm/amd/display: Handle null 'stream_status' in 'planes_changed_for_existing_stream' Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 152/244] drm/amd/display: Add NULL check for function pointer in dcn20_set_output_transfer_func Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 153/244] drm/amd/display: Add NULL check for function pointer in dcn401_set_output_transfer_func Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 154/244] drm/amd/display: Add NULL check for function pointer in dcn32_set_output_transfer_func Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 155/244] drm/amd/display: fix a UBSAN warning in DML2.1 Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 156/244] drm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor (v2) Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 157/244] drm/amd/display: Check null pointers before using dc->clk_mgr Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 158/244] drm/amd/display: Check null pointer before try to access it Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 159/244] drm/amd/display: Add null check for 'afb' in amdgpu_dm_plane_handle_cursor_update (v2) Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 161/244] drm/amd/display: fix double free issue during amdgpu module unload Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 162/244] drm/amdgpu: add list empty check to avoid null pointer issue Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 170/244] drm/amdgpu: add raven1 gfxoff quirk Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 171/244] drm/amdgpu: enable gfxoff quirk on HP 705G4 Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 172/244] drm/amdkfd: Fix resource leak in criu restore queue Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 179/244] drm/amd/display: Initialize denominators' default to 1 Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 180/244] drm/amd/display: Check null-initialized variables Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 181/244] drm/amd/display: Check phantom_stream before it is used Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 182/244] drm/amd/display: Check stream before comparing them Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 183/244] drm/amd/display: Deallocate DML memory if allocation fails Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 184/244] drm/amd/display: Check link_res->hpo_dp_link_enc before using it Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 185/244] drm/amd/display: Increase array size of dummy_boolean Sasha Levin
2024-09-25 11:26 ` Sasha Levin [this message]
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 187/244] drm/amd/display: Fix index out of bounds in degamma hardware format translation Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 188/244] drm/amd/display: Implement bounds check for stream encoder creation in DCN401 Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 189/244] drm/amd/display: Fix index out of bounds in DCN30 color transformation Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 190/244] drm/amdgpu/gfx12: properly handle error ints on all pipes Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 191/244] drm/amdgpu/gfx9: " Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 192/244] drm/amd/display: Fix possible overflow in integer multiplication Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 193/244] drm/amd/display: Check stream_status before it is used Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 194/244] drm/amd/display: Avoid overflow assignment in link_dp_cts Sasha Levin
2024-09-25 11:26 ` [PATCH AUTOSEL 6.11 195/244] drm/amd/display: Initialize get_bytes_per_element's default to 1 Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 202/244] drm/amd/display: Force enable 3DLUT DMA check for dcn401 in DML Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 203/244] drm/amdgpu: fix unchecked return value warning for amdgpu_gfx Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 204/244] drm/amdgpu: fix unchecked return value warning for amdgpu_atombios Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 207/244] drm/radeon/r100: Handle unknown family in r100_cp_init_microcode() Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 208/244] drm/amd/display: Unlock Pipes Based On DET Allocation Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 209/244] drm/amdgpu: fix ptr check warning in gfx9 ip_dump Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 210/244] drm/amdgpu: fix ptr check warning in gfx10 ip_dump Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 211/244] drm/amdgpu: fix ptr check warning in gfx11 ip_dump Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 212/244] drm/amdgpu: Block MMR_READ IOCTL in reset Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 213/244] drm/amdgpu/gfx9: use rlc safe mode for soft recovery Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 214/244] drm/amdgpu/gfx11: enter safe mode before touching CP_INT_CNTL Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 216/244] drm/amd/pm: ensure the fw_info is not null before using it Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 217/244] drm/amdkfd: Check int source id for utcl2 poison event Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 220/244] drm/amd/display: guard write a 0 post_divider value to HW Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 223/244] drm/amdgpu/gfx12: use rlc safe mode for soft recovery Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 224/244] drm/amdgpu/gfx11: " Sasha Levin
2024-09-25 11:27 ` [PATCH AUTOSEL 6.11 225/244] drm/amdgpu/gfx10: " Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240925113641.1297102-186-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alex.hung@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=chiahsuan.chung@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamza.mahfooz@amd.com \
--cc=harikrishna.revalla@amd.com \
--cc=harry.wentland@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roman.li@amd.com \
--cc=srinivasan.shanmugam@amd.com \
--cc=stable@vger.kernel.org \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox