Commit 8e88c752 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Don't parse garbage as DispID blocks

Currently the code assumes that the entire EDID extesion block
can be taken up by the DispID blocks. That is not true. There
is at least always the DispID checksum, and potentially fill
bytes if the extension block uses the interior fill scheme
to pad out to fill EDID block size.

So let's not parse the checksum or the fill bytes as DispID
blocks by having drm_find_displayid_extension() return the
actual length of the DispID data to the caller.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200313162054.16009-7-ville.syrjala@linux.intel.comReviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ea0aa608
...@@ -3216,6 +3216,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid, ...@@ -3216,6 +3216,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid,
int *length, int *idx) int *length, int *idx)
{ {
u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT); u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT);
struct displayid_hdr *base;
int ret; int ret;
if (!displayid) if (!displayid)
...@@ -3228,6 +3229,9 @@ static u8 *drm_find_displayid_extension(const struct edid *edid, ...@@ -3228,6 +3229,9 @@ static u8 *drm_find_displayid_extension(const struct edid *edid,
if (ret) if (ret)
return NULL; return NULL;
base = (struct displayid_hdr *)&displayid[*idx];
*length = *idx + sizeof(*base) + base->bytes;
return displayid; return displayid;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment