msm: camera: common: Add validation check for cpu buffers before accessing

Add validation check before accessing the packets and configs from
the buffers.

CRs-Fixed: 2360223, 2416463
Change-Id: I9a09bc7064fd7e7914f91576542181c301db926d
Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
This commit is contained in:
Abhilash Kumar
2019-04-25 21:18:33 +05:30
committed by Gerrit - the friendly Code Review server
parent 4329af66bd
commit 3ef8ba0db6
5 changed files with 62 additions and 1 deletions

View File

@@ -473,6 +473,17 @@ int cam_hw_cdm_submit_bl(struct cam_hw_info *cdm_hw,
if ((!rc) && (hw_vaddr_ptr) && (len) &&
(len >= cdm_cmd->cmd[i].offset)) {
if ((len - cdm_cmd->cmd[i].offset) <
cdm_cmd->cmd[i].len) {
CAM_ERR(CAM_CDM,
"Not enough buffer cmd offset: %u cmd length: %u",
cdm_cmd->cmd[i].offset,
cdm_cmd->cmd[i].len);
rc = -EINVAL;
break;
}
CAM_DBG(CAM_CDM, "Got the HW VA");
if (core->bl_tag >=
(CAM_CDM_HWFIFO_SIZE - 1))