linux/drivers/gpu/drm/amd/display
Harry Wentland ff287df16a drm/amd/display: Bound VBIOS record-chain walk loops
[Why & How]
All record-chain walk loops in bios_parser.c and bios_parser2.c use
for(;;) and only terminate on a 0xFF record_type sentinel or zero
record_size. A malformed VBIOS image missing the terminator record
causes unbounded iteration at probe time, potentially hundreds of
thousands of iterations with record_size=1. In the final iterations
near the BIOS image boundary, struct casts beyond the 2-byte header
validated by GET_IMAGE can also read out of bounds.

Cap all 14 record-chain walk loops to BIOS_MAX_NUM_RECORD (256)
iterations. The atombios.h defines up to 22 distinct record types
and atomfirmware.h has 13. Assuming an average of less than 10
records per type (which is reasonable since most are connector-
based) 256 is a generous upper bound.

Fixes: 4562236b3b ("drm/amd/dc: Add dc display driver (v2)")
Assisted-by: Copilot:claude-opus-4.6 Mythos
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 95700a3d66)
Cc: stable@vger.kernel.org
2026-06-03 14:45:44 -04:00
..
amdgpu_dm drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs 2026-06-03 14:44:13 -04:00
dc drm/amd/display: Bound VBIOS record-chain walk loops 2026-06-03 14:45:44 -04:00
dmub drm/amd/display: [FW Promotion] Release 0.1.53.0 2026-03-30 15:12:51 -04:00
include drm/amd/display: Read EDID from VBIOS embedded panel info 2026-04-29 10:41:40 -04:00
modules drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size 2026-06-03 14:45:23 -04:00
Kconfig drm/amd/display: add CEC notifier to amdgpu driver 2025-01-10 11:58:57 -05:00
Makefile drm/amd/display: Add Component To Handle Bounding Box Values and IP Caps 2025-08-29 10:14:02 -04:00