mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
msm: vidc: reject the buffer iova for incorrect mapping
Reject the buffer device address mapping when the device address is mapped in secure context bank for a non-secure instance and for the converse as well. Change-Id: Ic2fc578acd23d3582b390b24cc9d829d49d00d4d Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
This commit is contained in:
parent
a491b399dd
commit
16e264d6fa
1 changed files with 9 additions and 0 deletions
|
|
@ -185,6 +185,7 @@ int msm_smem_map_dma_buf(struct msm_vidc_inst *inst, struct msm_smem *smem)
|
|||
unsigned long align = SZ_4K;
|
||||
struct dma_buf *dbuf;
|
||||
unsigned long ion_flags = 0;
|
||||
u32 b_type = HAL_BUFFER_INPUT | HAL_BUFFER_OUTPUT | HAL_BUFFER_OUTPUT2;
|
||||
|
||||
if (!inst || !smem) {
|
||||
d_vpr_e("%s: invalid params: %pK %pK\n",
|
||||
|
|
@ -217,6 +218,14 @@ int msm_smem_map_dma_buf(struct msm_vidc_inst *inst, struct msm_smem *smem)
|
|||
if (ion_flags & ION_FLAG_SECURE)
|
||||
smem->flags |= SMEM_SECURE;
|
||||
|
||||
if ((smem->buffer_type & b_type) &&
|
||||
!!(smem->flags & SMEM_SECURE) ^ !!(inst->flags & VIDC_SECURE)) {
|
||||
s_vpr_e(inst->sid, "Failed to map %s buffer with %s session\n",
|
||||
smem->flags & SMEM_SECURE ? "secure" : "non-secure",
|
||||
inst->flags & VIDC_SECURE ? "secure" : "non-secure");
|
||||
rc = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
buffer_size = smem->size;
|
||||
|
||||
rc = msm_dma_get_device_address(dbuf, align, &iova, &buffer_size,
|
||||
|
|
|
|||
Loading…
Reference in a new issue