diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-03-26 13:43:06 +0100 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:14:55 -0700 |
commit | 644d1f162ca8034959314312c7ac5d066bdc93fc (patch) | |
tree | 9e8c4e5088a01ed22d03b15dd7b2e90e798eb211 /drivers/iommu | |
parent | e72266d2006269e784c6d022b0759c0451a11cab (diff) |
iommu: Only allow iommu_map/unmap for paging domains
Check for the new __IOMMU_DOMAIN_PAGING flag before calling
into the iommu drivers ->map and ->unmap call-backs.
Change-Id: If4c6a7133fd33797f7e685629ef5793de3288e32
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
[pdaly@codeaurora.org Resolve minor conflicts]
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/iommu.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 825a69658ae9..e4890e4fa47f 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1124,6 +1124,9 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, return -ENODEV; } + if (unlikely(!(domain->type & __IOMMU_DOMAIN_PAGING))) + return -EINVAL; + /* find out the minimum page size supported */ min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap); @@ -1180,6 +1183,12 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size) trace_unmap_end(iova, 0, size); return -ENODEV; } + + if (unlikely(!(domain->type & __IOMMU_DOMAIN_PAGING))) { + trace_unmap_end(iova, 0, size); + return -EINVAL; + } + /* find out the minimum page size supported */ min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap); |