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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Add sanity checks for drm_edid_raw()

When EDID is retrieved via drm_edid_raw(), it doesn't guarantee to
return proper EDID bytes the caller wants: it may be either NULL (that
leads to an Oops) or with too long bytes over the fixed size raw_edid
array (that may lead to memory corruption). The latter was reported
actually when connected with a bad adapter.

Add sanity checks for drm_edid_raw() to address the above corner
cases, and return EDID_BAD_INPUT accordingly.

Fixes: 48edb2a4256e ("drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid")
Link: https://bugzilla.suse.com/show_bug.cgi?id=1236415
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Takashi Iwai and committed by
Alex Deucher
648d3f4d 1b92cb40

+4
+4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
··· 1029 1029 return EDID_NO_RESPONSE; 1030 1030 1031 1031 edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw() 1032 + if (!edid || 1033 + edid->extensions >= sizeof(sink->dc_edid.raw_edid) / EDID_LENGTH) 1034 + return EDID_BAD_INPUT; 1035 + 1032 1036 sink->dc_edid.length = EDID_LENGTH * (edid->extensions + 1); 1033 1037 memmove(sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); 1034 1038