intel-iommu: Warn about unmatched unmap requests

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, July 3, 2009 - 5:59 pm

Gitweb:     http://git.kernel.org/linus/85b98276f2ffa66b25ae6328b00bfadfd74b74e7
Commit:     85b98276f2ffa66b25ae6328b00bfadfd74b74e7
Parent:     206a73c102fc480ba072a9388bc2142c303113aa
Author:     David Woodhouse <David.Woodhouse@intel.com>
AuthorDate: Wed Jul 1 19:27:53 2009 +0100
Committer:  David Woodhouse <David.Woodhouse@intel.com>
CommitDate: Wed Jul 1 19:54:37 2009 +0100

    intel-iommu: Warn about unmatched unmap requests
    
    This would have found the bug in i386 pci_unmap_addr() a long time ago.
    We shouldn't just silently return without doing anything.
    
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
 drivers/pci/intel-iommu.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 02223e2..2bbc3fc 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2640,7 +2640,8 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr,
 	iommu = domain_get_iommu(domain);
 
 	iova = find_iova(&domain->iovad, IOVA_PFN(dev_addr));
-	if (!iova)
+	if (WARN_ONCE(!iova, "Driver unmaps unmatched page at PFN %llx\n",
+		      (unsigned long long)dev_addr))
 		return;
 
 	start_pfn = mm_to_dma_pfn(iova->pfn_lo);
@@ -2730,7 +2731,8 @@ static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist,
 	iommu = domain_get_iommu(domain);
 
 	iova = find_iova(&domain->iovad, IOVA_PFN(sglist[0].dma_address));
-	if (!iova)
+	if (WARN_ONCE(!iova, "Driver unmaps unmatched sglist at PFN %llx\n",
+		      (unsigned long long)sglist[0].dma_address))
 		return;
 
 	start_pfn = mm_to_dma_pfn(iova->pfn_lo);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
intel-iommu: Warn about unmatched unmap requests, Linux Kernel Mailing List..., (Fri Jul 3, 5:59 pm)