summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_edid.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2020-03-13 17:20:51 +0100
committerVille Syrjälä <ville.syrjala@linux.intel.com>2020-03-18 16:52:36 +0100
commit8e88c75245a3f84e3503bff2fa39a9178e8efb5f (patch)
treead412b42eb8d484b23c2d758f004a16939ae90b4 /drivers/gpu/drm/drm_edid.c
parentdrm/edid: Move validate_displayid() drm_find_displayid_extension() (diff)
downloadlinux-8e88c75245a3f84e3503bff2fa39a9178e8efb5f.tar.xz
linux-8e88c75245a3f84e3503bff2fa39a9178e8efb5f.zip
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: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200313162054.16009-7-ville.syrjala@linux.intel.com Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r--drivers/gpu/drm/drm_edid.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 2b8e22cc1407..35d46f5ffb60 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3216,6 +3216,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid,
int *length, int *idx)
{
u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT);
+ struct displayid_hdr *base;
int ret;
if (!displayid)
@@ -3228,6 +3229,9 @@ static u8 *drm_find_displayid_extension(const struct edid *edid,
if (ret)
return NULL;
+ base = (struct displayid_hdr *)&displayid[*idx];
+ *length = *idx + sizeof(*base) + base->bytes;
+
return displayid;
}