[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1517363285-89304-3-git-send-email-suravee.suthikulpanit@amd.com>
Date: Tue, 30 Jan 2018 20:48:05 -0500
From: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
To: iommu@...ts.linux-foundation.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: joro@...tes.org, jroedel@...e.de, alex.williamson@...hat.com,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Subject: [PATCH 2/2] vfio/type1: Add iommu_unmap error check when vfio_unmap_unpin
Besides zero check the number of unmapped page, also check
and handle iommu_unmap errors.
Cc: Alex Williamson <alex.williamson@...hat.com>
Cc: Joerg Roedel <joro@...tes.org>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
---
drivers/vfio/vfio_iommu_type1.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index e30e29a..c580518 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -677,7 +677,8 @@ static long vfio_unmap_unpin(struct vfio_iommu *iommu, struct vfio_dma *dma,
}
while (iova < end) {
- size_t unmapped, len;
+ ssize_t unmapped;
+ size_t len;
phys_addr_t phys, next;
phys = iommu_iova_to_phys(domain->domain, iova);
@@ -699,7 +700,7 @@ static long vfio_unmap_unpin(struct vfio_iommu *iommu, struct vfio_dma *dma,
}
unmapped = iommu_unmap(domain->domain, iova, len);
- if (WARN_ON(!unmapped))
+ if (WARN_ON(unmapped <= 0))
break;
unlocked += vfio_unpin_pages_remote(dma, iova,
--
1.8.3.1
Powered by blists - more mailing lists