2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-03-22 14:52:12 +08:00
|
|
|
From: Anil Kumar <anil.kumar.k@intel.com>
|
|
|
|
Date: Fri, 15 Mar 2019 10:22:16 -0700
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] ipu-mmu.c: Fix possible null pointer dereference
|
2019-03-22 14:52:12 +08:00
|
|
|
|
|
|
|
Change-Id: I85281c8b164b095b3cdf150d4a560d1c86c0c425
|
|
|
|
Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
|
|
|
|
Tracked-On: PKT-1814
|
|
|
|
---
|
|
|
|
drivers/media/pci/intel/ipu-mmu.c | 21 ++++++++++++---------
|
|
|
|
1 file changed, 12 insertions(+), 9 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/drivers/media/pci/intel/ipu-mmu.c b/drivers/media/pci/intel/ipu-mmu.c
|
2020-10-27 02:14:06 +08:00
|
|
|
index 7718732fe5e6..968c55316e6d 100644
|
2019-03-22 14:52:12 +08:00
|
|
|
--- a/drivers/media/pci/intel/ipu-mmu.c
|
|
|
|
+++ b/drivers/media/pci/intel/ipu-mmu.c
|
|
|
|
@@ -341,16 +341,19 @@ static void ipu_mmu_domain_destroy(struct iommu_domain *domain)
|
|
|
|
if (adom->iova_addr_trash) {
|
|
|
|
iova = find_iova(&adom->dmap->iovad, adom->iova_addr_trash >>
|
|
|
|
PAGE_SHIFT);
|
|
|
|
- /* unmap and free the corresponding trash buffer iova */
|
|
|
|
- iommu_unmap(domain, iova->pfn_lo << PAGE_SHIFT,
|
|
|
|
- (iova->pfn_hi - iova->pfn_lo + 1) << PAGE_SHIFT);
|
|
|
|
- __free_iova(&adom->dmap->iovad, iova);
|
|
|
|
|
|
|
|
- /*
|
|
|
|
- * Set iova_addr_trash in mmu to 0, so that on next HW init
|
|
|
|
- * this will be mapped again.
|
|
|
|
- */
|
|
|
|
- adom->iova_addr_trash = 0;
|
|
|
|
+ if (iova) {
|
|
|
|
+ /* unmap and free the corresponding trash buffer iova */
|
|
|
|
+ iommu_unmap(domain, iova->pfn_lo << PAGE_SHIFT,
|
|
|
|
+ (iova->pfn_hi - iova->pfn_lo + 1) << PAGE_SHIFT);
|
|
|
|
+ __free_iova(&adom->dmap->iovad, iova);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Set iova_addr_trash in mmu to 0, so that on next HW init
|
|
|
|
+ * this will be mapped again.
|
|
|
|
+ */
|
|
|
|
+ adom->iova_addr_trash = 0;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
for (l1_idx = 0; l1_idx < ISP_L1PT_PTES; l1_idx++)
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2019-03-22 14:52:12 +08:00
|
|
|
|