intel-iommu: Warn about unmatched unmap requests
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 1 Jul 2009 18:27:53 +0000 (19:27 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 1 Jul 2009 18:54:37 +0000 (19:54 +0100)
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

index 02223e2e27d4380e34ed49b17484ac7374e30a8e..2bbc3fc88dc9f078f37f8424f61007a1c460224b 100644 (file)
@@ -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);