diff options
author | Joerg Roedel <joro@8bytes.org> | 2013-01-29 13:41:09 +0100 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2013-02-06 10:47:05 +0100 |
commit | 57886518a8cdd319a04f5ea06a5f7ffcb8a93120 (patch) | |
tree | 85de286abc27f32dd18ad4f9eb5488288e98e681 /drivers/iommu | |
parent | a8b8a88a9e3042d41326c854272c881664acba1c (diff) | |
download | op-kernel-dev-57886518a8cdd319a04f5ea06a5f7ffcb8a93120.zip op-kernel-dev-57886518a8cdd319a04f5ea06a5f7ffcb8a93120.tar.gz |
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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 1065a1a..4e6d6f8 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 */ |