From: Sheng Yang Date: Wed, 8 Jul 2009 10:52:52 +0000 (+0100) Subject: intel-iommu: Fix intel_iommu_unmap_range() with size 0 X-Git-Tag: v2.6.31-rc3~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b99d3527041bec1abe9903263a3a1b7d2ba0c4a;p=platform%2Fupstream%2Fkernel-adaptation-pc.git intel-iommu: Fix intel_iommu_unmap_range() with size 0 After some API change, intel_iommu_unmap_range() introduced a assumption that parameter size != 0, otherwise the dma_pte_clean_range() would have a overflowed argument. But the user like KVM don't have this assumption before, then some BUG() triggered. Fix it by ignoring size = 0. Signed-off-by: Sheng Yang Signed-off-by: David Woodhouse Signed-off-by: Linus Torvalds --- diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 360fb67..ebc9b8d 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -3600,6 +3600,9 @@ static void intel_iommu_unmap_range(struct iommu_domain *domain, { struct dmar_domain *dmar_domain = domain->priv; + if (!size) + return; + dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, (iova + size - 1) >> VTD_PAGE_SHIFT);