Skip to content

Commit 3dfe85f

Browse files
Harry Wentlandalexdeucher
authored andcommitted
drm/amd/display: Avoid reading audio pattern past AUDIO_CHANNELS_COUNT
A faulty receiver might report an erroneous channel count. We should guard against reading beyond AUDIO_CHANNELS_COUNT as that would overflow the dpcd_pattern_period array. Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 19965d8 commit 3dfe85f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,7 @@ static void dp_test_get_audio_test_data(struct dc_link *link, bool disable_video
44404440
&dpcd_pattern_type.value,
44414441
sizeof(dpcd_pattern_type));
44424442

4443-
channel_count = dpcd_test_mode.bits.channel_count + 1;
4443+
channel_count = min(dpcd_test_mode.bits.channel_count + 1, AUDIO_CHANNELS_COUNT);
44444444

44454445
// read pattern periods for requested channels when sawTooth pattern is requested
44464446
if (dpcd_pattern_type.value == AUDIO_TEST_PATTERN_SAWTOOTH ||

0 commit comments

Comments
 (0)