drm/amd/display: fix possible buffer overflow relating to secure display
authorHamza Mahfooz <hamza.mahfooz@amd.com>
Wed, 11 Jan 2023 17:25:14 +0000 (12:25 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Jan 2023 19:49:59 +0000 (14:49 -0500)
commitc3d749609472ba0b217b42ab66f80459847e2bcb
tree1098366e455abc9b0301ceb517c3befd8c0ea6a6
parent0c2dece8fb541ab07b68c3312a1065fa9c927a81
drm/amd/display: fix possible buffer overflow relating to secure display

It is possible that adev->dm.dc->caps.max_links is greater than
AMDGPU_MAX_CRTCS. So, to not potentially access unallocated memory use
adev->mode_info.num_crtc to do the bounds check instead of
adev->dm.dc->caps.max_links.

Fixes: 1b11ff764aef ("drm/amd/display: Implement multiple secure display")
Fixes: b8ff7e08bab9 ("drm/amd/display: Fix when disabling secure_display")
Reviewed-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c