Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add hpd_source index check for DCE60/80/100/110/112/120 link encoders

This patch adds a boundary check for the hpd_source index during the
link encoder creation process for all DCExxx IP's. 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 <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: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Srinivasan Shanmugam and committed by
Alex Deucher
7c8fb3b8 785504dd

+6 -6
+1 -1
drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
··· 717 717 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); 718 718 int link_regs_id; 719 719 720 - if (!enc110) 720 + if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) 721 721 return NULL; 722 722 723 723 link_regs_id =
+1 -1
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c
··· 623 623 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); 624 624 int link_regs_id; 625 625 626 - if (!enc110) 626 + if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) 627 627 return NULL; 628 628 629 629 link_regs_id =
+1 -1
drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c
··· 668 668 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); 669 669 int link_regs_id; 670 670 671 - if (!enc110) 671 + if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) 672 672 return NULL; 673 673 674 674 link_regs_id =
+1 -1
drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c
··· 629 629 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); 630 630 int link_regs_id; 631 631 632 - if (!enc110) 632 + if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) 633 633 return NULL; 634 634 635 635 link_regs_id =
+1 -1
drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c
··· 706 706 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); 707 707 int link_regs_id; 708 708 709 - if (!enc110) 709 + if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) 710 710 return NULL; 711 711 712 712 link_regs_id =
+1 -1
drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c
··· 723 723 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); 724 724 int link_regs_id; 725 725 726 - if (!enc110) 726 + if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) 727 727 return NULL; 728 728 729 729 link_regs_id =