Skip to content

Commit

Permalink
intel-iommu: Warn about unmatched unmap requests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jul 1, 2009
1 parent 206a73c commit 85b9827
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 85b9827

Please sign in to comment.