intel-iommu: Fix intel_iommu_unmap_range() with size 0

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, July 8, 2009 - 9:59 am

Gitweb:     http://git.kernel.org/linus/4b99d3527041bec1abe9903263a3a1b7d2ba0c4a
Commit:     4b99d3527041bec1abe9903263a3a1b7d2ba0c4a
Parent:     0f2f2221b4ad816567394a52643963428fd353cd
Author:     Sheng Yang <sheng@linux.intel.com>
AuthorDate: Wed Jul 8 11:52:52 2009 +0100
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Wed Jul 8 09:35:10 2009 -0700

    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 <sheng@linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 drivers/pci/intel-iommu.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

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);
 
--
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: Fix intel_iommu_unmap_range() with size 0, Linux Kernel Mailing ..., (Wed Jul 8, 9:59 am)