msm: cvp: Fix to avoid cache entry for unwanted buffer

Error handle to avoid dereferencing of unwanted buffer during deinit

Change-Id: I0414c18b5a0bba1e1f915c59ba99cce82c0e98fe
Signed-off-by: Haseeb Khan <hkhan@codeaurora.org>
This commit is contained in:
Haseeb Khan 2020-12-11 16:40:42 +05:30 committed by Pulkit Singh Tak
parent c0a8ba67dd
commit fa2c98ac0e

View File

@ -382,7 +382,11 @@ static struct msm_cvp_smem *msm_cvp_session_get_smem(struct msm_cvp_inst *inst,
rc = msm_cvp_map_smem(inst, smem, "map cpu");
if (rc)
goto exit;
if (buf->size > smem->size || buf->size > smem->size - buf->offset) {
dprintk(CVP_ERR, "%s: invalid offset %d or size %d for a new entry\n",
__func__, buf->offset, buf->size);
goto exit2;
}
rc = msm_cvp_session_add_smem(inst, smem);
if (rc && rc != -ENOMEM)
goto exit2;