[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200521113004.12438-1-guptap@codeaurora.org>
Date: Thu, 21 May 2020 17:00:04 +0530
From: Prakash Gupta <guptap@...eaurora.org>
To: akpm@...ux-foundation.org, mhocko@...e.com, joro@...tes.org
Cc: iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Prakash Gupta <guptap@...eaurora.org>
Subject: [PATCH] iommu/dma: limit iova free size to unmmaped iova
Limit the iova size while freeing based on unmapped size. In absence of
this even with unmap failure, invalid iova is pushed to iova rcache and
subsequently can cause panic while rcache magazine is freed.
Signed-off-by: Prakash Gupta <guptap@...eaurora.org>
:100644 100644 4959f5df21bd 098f7d377e04 M drivers/iommu/dma-iommu.c
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 4959f5df21bd..098f7d377e04 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -472,7 +472,8 @@ static void __iommu_dma_unmap(struct device *dev, dma_addr_t dma_addr,
if (!cookie->fq_domain)
iommu_tlb_sync(domain, &iotlb_gather);
- iommu_dma_free_iova(cookie, dma_addr, size);
+ if (unmapped)
+ iommu_dma_free_iova(cookie, dma_addr, unmapped);
}
static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists