summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joro@8bytes.org>2013-01-29 13:41:09 +0100
committerJoerg Roedel <joro@8bytes.org>2013-02-06 10:47:05 +0100
commit57886518a8cdd319a04f5ea06a5f7ffcb8a93120 (patch)
tree85de286abc27f32dd18ad4f9eb5488288e98e681 /drivers/iommu
parenta8b8a88a9e3042d41326c854272c881664acba1c (diff)
downloadlinux-rpi-57886518a8cdd319a04f5ea06a5f7ffcb8a93120.tar.gz
linux-rpi-57886518a8cdd319a04f5ea06a5f7ffcb8a93120.tar.bz2
linux-rpi-57886518a8cdd319a04f5ea06a5f7ffcb8a93120.zip
iommu: Check for valid pgsize_bitmap in iommu_map/unmap
In case the page-size bitmap is zero the code path in iommu_map and iommu_unmap is undefined. Make it defined and return -ENODEV in this case. Signed-off-by: Joerg Roedel <joro@8bytes.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/iommu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1065a1a19478..4e6d6f857e6f 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -734,7 +734,8 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
size_t orig_size = size;
int ret = 0;
- if (unlikely(domain->ops->map == NULL))
+ if (unlikely(domain->ops->unmap == NULL ||
+ domain->ops->pgsize_bitmap == 0UL))
return -ENODEV;
/* find out the minimum page size supported */
@@ -808,7 +809,8 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
size_t unmapped_page, unmapped = 0;
unsigned int min_pagesz;
- if (unlikely(domain->ops->unmap == NULL))
+ if (unlikely(domain->ops->unmap == NULL ||
+ domain->ops->pgsize_bitmap == 0UL))
return -ENODEV;
/* find out the minimum page size supported */