Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0a9dd72 authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Validate buffer size before mapping



Validate the buffer size returned from api ion_share_dma_buf()
with the actual buffer size before mapping the buffer using
api msm_dma_map_sg_attrs() to resolve video usecases failures.

CRs-Fixed: 2119739
Change-Id: I2427cccfbb5d6f0458e425342a81fa531df9ed76
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent d14a930f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ static int msm_ion_get_device_address(struct smem_client *smem_client,
			dprintk(VIDC_ERR,
				"Size mismatch! Dmabuf size: %zu Expected Size: %lu",
				buf->size, *buffer_size);
			msm_vidc_res_handle_fatal_hw_error(smem_client->res,
					true);
			goto mem_buf_size_mismatch;
		}
		/* Prepare a dma buf for dma on the given device */
@@ -327,6 +329,7 @@ static int msm_ion_map_dma_buf(struct msm_vidc_inst *inst,
	if (ion_flags & ION_FLAG_SECURE)
		smem->flags |= SMEM_SECURE;

	buffer_size = smem->size;
	rc = msm_ion_get_device_address(inst->mem_client, ion_handle,
			align, &iova, &buffer_size, smem->flags,
			smem->buffer_type, &smem->mapping_info);