From: Srinivasan Shanmugam Date: Thu, 17 Oct 2024 02:04:38 +0000 (+0530) Subject: drm/amd/display: Add hpd_source index check for dcn10 link encoder setup X-Git-Tag: v6.13-rc1~122^2~15^2~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3fc44b98043df7a843e43eb217bc937f3d7a9d8;p=thirdparty%2Fkernel%2Flinux.git drm/amd/display: Add hpd_source index check for dcn10 link encoder setup This patch adds a boundary check for the hpd_source index during the link encoder creation process for all dcn10 ip. The check ensures that the index is within the valid range of the link_enc_hpd_regs array to prevent out-of-bounds access. Cc: Tom Chung Cc: Rodrigo Siqueira Cc: Roman Li Cc: Alex Hung Cc: Aurabindo Pillai Cc: Harry Wentland Cc: Hamza Mahfooz Signed-off-by: Srinivasan Shanmugam Reviewed-by: Roman Li Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c index 563c5eec83ff3..05d6d41ef9d31 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c @@ -751,7 +751,7 @@ static struct link_encoder *dcn10_link_encoder_create( kzalloc(sizeof(struct dcn10_link_encoder), GFP_KERNEL); int link_regs_id; - if (!enc10) + if (!enc10 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; link_regs_id =