linux/drivers/gpu/drm/amd/display/dc/bios
Harry Wentland 86d2b20644 drm/amd/display: Validate GPIO pin LUT table size before iterating
[Why&How]
The GPIO pin table parsers in get_gpio_i2c_info() and
bios_parser_get_gpio_pin_info() derive an element count from the VBIOS
table_header.structuresize field, then iterate over gpio_pin[] entries.
However, GET_IMAGE() only validates that the table header itself fits
within the BIOS image. If the VBIOS reports a structuresize larger than
the actual mapped data, the loop reads past the end of the BIOS image,
causing an out-of-bounds read.

Fix this by calling bios_get_image() to validate that the full claimed
structuresize is accessible within the BIOS image before entering the
loop in both functions.

Assisted-by: GitHub Copilot:claude-opus-4-6
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ba5e95b43b773ae1bf1f66ee6b31eb774e65afe3)
Cc: stable@vger.kernel.org
2026-05-19 12:13:29 -04:00
..
dce60 drm/amd/display/dc: Refactor remove duplications 2025-02-27 15:52:32 -05:00
dce80 drm/amd/display/dc: Refactor remove duplications 2025-02-27 15:52:32 -05:00
dce110 drm/amd/display: Fixed Silence complier warnings in dc 2026-03-30 15:12:15 -04:00
dce112 drm/amd/display: Fixed Silence complier warnings in dc 2026-03-30 15:12:15 -04:00
bios_parser_common.c drm/amd/display: Add support for USBC connector 2022-03-31 23:05:53 -04:00
bios_parser_common.h
bios_parser_helper.c drm/amd/display: Fix integer overflow in bios_get_image() 2026-05-19 12:13:07 -04:00
bios_parser_helper.h drm/amd/display: Remove unused function bios_get_vga_enabled_displays 2024-09-26 17:06:17 -04:00
bios_parser_interface.c
bios_parser_types_internal.h
bios_parser_types_internal2.h drm/amd/display: Add dependant changes for DCN32/321 2022-06-03 16:43:38 -04:00
bios_parser.c drm/amd/display: Read EDID from VBIOS embedded panel info 2026-04-29 10:41:40 -04:00
bios_parser.h
bios_parser2.c drm/amd/display: Validate GPIO pin LUT table size before iterating 2026-05-19 12:13:29 -04:00
bios_parser2.h
command_table_helper_struct.h
command_table_helper.c drm/amd/display/dc: Refactor remove duplications 2025-02-27 15:52:32 -05:00
command_table_helper.h drm/amd/display/dc: Refactor remove duplications 2025-02-27 15:52:32 -05:00
command_table_helper2.c drm/amd/display: Enable dcn42 DC 2026-02-23 14:28:33 -05:00
command_table_helper2.h
command_table.c drm/amd/display: Implement BIOS parser external encoder control 2026-02-23 14:28:32 -05:00
command_table.h drm/amd/display: Add missing encoder setup to DACnEncoderControl 2026-01-05 17:00:00 -05:00
command_table2.c drm/amd/display: Fixed Silence complier warnings in dc 2026-03-30 15:12:15 -04:00
command_table2.h drm/amd/display: Pass pwrseq inst for backlight and ABM 2023-12-06 15:22:33 -05:00
Makefile