From: hyesoo.yu Date: Fri, 20 Apr 2018 08:19:55 +0000 (+0900) Subject: android: ion: confirm to unmap invalid secure iova X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=560123c229a894ec09d50280f1a67a8faa2c2516;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git android: ion: confirm to unmap invalid secure iova Change-Id: Ifc926d9f85bed09c7c953fd4126f8a22e9c16e76 Signed-off-by: hyesoo.yu --- diff --git a/drivers/staging/android/ion/ion_exynos.c b/drivers/staging/android/ion/ion_exynos.c index 21d4b2e74040..5b3c07a87280 100644 --- a/drivers/staging/android/ion/ion_exynos.c +++ b/drivers/staging/android/ion/ion_exynos.c @@ -133,6 +133,17 @@ void ion_iovmm_unmap(struct dma_buf_attachment *attachment, dma_addr_t iova) struct ion_iovm_map *iovm_map; struct iommu_domain *domain; + if (IS_ENABLED(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) && + (buffer->flags & ION_FLAG_PROTECTED)) { + struct ion_buffer_prot_info *prot = buffer->priv_virt; + + if (prot->dma_addr != iova) + WARN(1, "unmap invalid secure iova %pad for %#x\n", + &iova, (int)prot->dma_addr); + + return; + } + domain = get_domain_from_dev(attachment->dev); if (!domain) { dev_err(attachment->dev, "%s: no iommu domain\n", __func__); @@ -148,7 +159,8 @@ void ion_iovmm_unmap(struct dma_buf_attachment *attachment, dma_addr_t iova) } } - WARN(1, "iova %pad found for %s\n", &iova, dev_name(attachment->dev)); + WARN(1, "iova %pad not found for %s\n", + &iova, dev_name(attachment->dev)); } /*