diff options
author | Joerg Roedel <joro@8bytes.org> | 2013-01-29 07:41:09 -0500 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2013-02-06 04:47:05 -0500 |
commit | 57886518a8cdd319a04f5ea06a5f7ffcb8a93120 (patch) | |
tree | 85de286abc27f32dd18ad4f9eb5488288e98e681 /drivers/iommu | |
parent | a8b8a88a9e3042d41326c854272c881664acba1c (diff) |
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 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, | |||
734 | size_t orig_size = size; | 734 | size_t orig_size = size; |
735 | int ret = 0; | 735 | int ret = 0; |
736 | 736 | ||
737 | if (unlikely(domain->ops->map == NULL)) | 737 | if (unlikely(domain->ops->unmap == NULL || |
738 | domain->ops->pgsize_bitmap == 0UL)) | ||
738 | return -ENODEV; | 739 | return -ENODEV; |
739 | 740 | ||
740 | /* find out the minimum page size supported */ | 741 | /* 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) | |||
808 | size_t unmapped_page, unmapped = 0; | 809 | size_t unmapped_page, unmapped = 0; |
809 | unsigned int min_pagesz; | 810 | unsigned int min_pagesz; |
810 | 811 | ||
811 | if (unlikely(domain->ops->unmap == NULL)) | 812 | if (unlikely(domain->ops->unmap == NULL || |
813 | domain->ops->pgsize_bitmap == 0UL)) | ||
812 | return -ENODEV; | 814 | return -ENODEV; |
813 | 815 | ||
814 | /* find out the minimum page size supported */ | 816 | /* find out the minimum page size supported */ |