msm: mdss: hdmi: validate HDMI EDID's max number of CEA blocks

No upper-bound validation is performed when reading number of
extended CEA blocks from the untrusted source (EDID). Add a check
to limit the number of CEA extension blocks.

Change-Id: I69f09ed0ad28a4c267cf3e8f7a12efe46f75e244
Signed-off-by: Narender Ankam <nankam@codeaurora.org>
This commit is contained in:
Narender Ankam 2017-08-23 15:30:55 +05:30 committed by Gerrit - the friendly Code Review server
parent f48ed0afc6
commit dee518597a
1 changed files with 7 additions and 0 deletions

View File

@ -1724,6 +1724,13 @@ int hdmi_edid_parser(void *input)
goto bail;
}
/* Find out if CEA extension blocks exceeding max limit */
if (num_of_cea_blocks >= MAX_EDID_BLOCKS) {
DEV_WARN("%s: HDMI EDID exceeded max CEA blocks limit\n",
__func__);
num_of_cea_blocks = MAX_EDID_BLOCKS - 1;
}
/* check for valid CEA block */
if (edid_buf[EDID_BLOCK_SIZE] != 2) {
DEV_ERR("%s: Invalid CEA block\n", __func__);