AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@amd.com>,
	Rodrigo Siqueira <rodrigo.siqueira@amd.com>,
	Hamza Mahfooz <hamza.mahfooz@amd.com>,
	Aurabindo Pillai <aurabindo.pillai@amd.com>,
	"Roman Li" <roman.li@amd.com>, Wayne Lin <wayne.lin@amd.com>,
	Tom Chung <chiahsuan.chung@amd.com>,
	Fangzhi Zuo <jerry.zuo@amd.com>,
	Zaeem Mohamed <zaeem.mohamed@amd.com>,
	Solomon Chiu <solomon.chiu@amd.com>,
	Daniel Wheeler <daniel.wheeler@amd.com>,
	Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Subject: [PATCH 15/16] drm/amd/display: Adjust VSDB parser for replay feature
Date: Tue, 5 Nov 2024 15:22:16 -0500	[thread overview]
Message-ID: <20241105202341.154036-16-hamza.mahfooz@amd.com> (raw)
In-Reply-To: <20241105202341.154036-1-hamza.mahfooz@amd.com>

From: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>

At some point, the IEEE ID identification for the replay check in the
AMD EDID was added. However, this check causes the following
out-of-bounds issues when using KASAN:

[   27.804016] BUG: KASAN: slab-out-of-bounds in amdgpu_dm_update_freesync_caps+0xefa/0x17a0 [amdgpu]
[   27.804788] Read of size 1 at addr ffff8881647fdb00 by task systemd-udevd/383

...

[   27.821207] Memory state around the buggy address:
[   27.821215]  ffff8881647fda00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   27.821224]  ffff8881647fda80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   27.821234] >ffff8881647fdb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.821243]                    ^
[   27.821250]  ffff8881647fdb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.821259]  ffff8881647fdc00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   27.821268] ==================================================================

This is caused because the ID extraction happens outside of the range of
the edid lenght. This commit addresses this issue by considering the
amd_vsdb_block size.

Cc: ChiaHsuan Chung <chiahsuan.chung@amd.com>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1d47719e7af1..8381afbe6e4d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -12096,7 +12096,7 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
 			break;
 	}
 
-	while (j < EDID_LENGTH) {
+	while (j < EDID_LENGTH - sizeof(struct amd_vsdb_block)) {
 		struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j];
 		unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]);
 
-- 
2.46.1


  parent reply	other threads:[~2024-11-05 20:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 20:22 [PATCH 00/16] DC Patches November 5, 2024 Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 01/16] drm/amd/display: Refactor HPD IRQ error checking flow Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 02/16] drm/amd/display: Change parameters to fix certain compiler errors Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 03/16] drm/amd/display: Change some variable name of psr Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 04/16] drm/amd/display: Fix Panel Replay not update screen correctly Hamza Mahfooz
2024-11-06 20:25   ` Mario Limonciello
2024-11-07 14:15     ` Mario Limonciello
2024-11-07 15:03       ` Mario Limonciello
2024-11-05 20:22 ` [PATCH 05/16] drm/amd/display: Adding flag for forced MST blocked discovery Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 06/16] drm/amd/display: Read DP tunneling support only for DPIA endpoints Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 07/16] drm/amd/display: always blank stream before disable crtc Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 08/16] drm/amd/display: disabling p-state checks for DCN31 and DCN314 Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 09/16] drm/amd/display: Update SPL Taps Required For Integer Scaling Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 10/16] drm/amd/display: Use region6 size in fw_meta_info Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 11/16] drm/amd/display: Handle dml allocation failure to avoid crash Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 12/16] drm/amd/display: Require minimum VBlank size for stutter optimization Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 13/16] drm/amd/display: update pipe selection policy to check head pipe Hamza Mahfooz
2024-11-05 20:22 ` [PATCH 14/16] drm/amd/display: Remove unused code Hamza Mahfooz
2024-11-05 20:22 ` Hamza Mahfooz [this message]
2024-11-05 20:22 ` [PATCH 16/16] drm/amd/display: 3.2.309 Hamza Mahfooz

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=20241105202341.154036-16-hamza.mahfooz@amd.com \
    --to=hamza.mahfooz@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=rodrigo.siqueira@amd.com \
    --cc=roman.li@amd.com \
    --cc=solomon.chiu@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=wayne.lin@amd.com \
    --cc=zaeem.mohamed@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