summaryrefslogtreecommitdiff
path: root/drivers/iommu/fsl_pamu_domain.c
diff options
context:
space:
mode:
authorJ. German Rivera <Jose.G.Rivera@freescale.com>2013-08-30 19:04:36 (GMT)
committerJ. German Rivera <German.Rivera@freescale.com>2013-08-30 19:04:36 (GMT)
commit994a9d7b30088adf0d931c0287ce95c0b5000620 (patch)
tree2c070e62add54013c82b3ab6dfe21b494fa535e9 /drivers/iommu/fsl_pamu_domain.c
parentb266c1eb20898fd6f066dfb15c930d4a8d58538b (diff)
parent2baf518cf0005757c3851f9c2ce18904d2a0218e (diff)
downloadlinux-fsl-qoriq-994a9d7b30088adf0d931c0287ce95c0b5000620.tar.xz
Merge branch 'b4860rev2'
Diffstat (limited to 'drivers/iommu/fsl_pamu_domain.c')
-rw-r--r--drivers/iommu/fsl_pamu_domain.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index 99c182d..b7b915e 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -800,6 +800,11 @@ static int configure_domain_geometry(struct iommu_domain *domain, void *data)
return 0;
}
+static inline int check_attr_window(u32 wnd, struct fsl_dma_domain *dma_domain)
+{
+ return ((~wnd != 0) && (wnd >= dma_domain->win_cnt));
+}
+
/* Set the domain operation mapping attribute */
static int configure_domain_op_map(struct fsl_dma_domain *dma_domain,
void *data)
@@ -818,7 +823,8 @@ static int configure_domain_op_map(struct fsl_dma_domain *dma_domain,
return -ENODEV;
}
- if (omi_attr->omi >= OMI_MAX) {
+ if (omi_attr->omi >= OMI_MAX ||
+ check_attr_window(omi_attr->window, dma_domain)) {
pr_err("Invalid operation mapping index\n");
spin_unlock_irqrestore(&dma_domain->domain_lock, flags);
return -EINVAL;
@@ -863,7 +869,8 @@ static int configure_domain_stash(struct fsl_dma_domain *dma_domain, void *data)
stash_id = get_stash_id(stash_attr->cache,
stash_attr->cpu);
- if (~stash_id == 0) {
+ if ((~stash_id == 0) ||
+ check_attr_window(stash_attr->window, dma_domain)) {
pr_err("Invalid stash attributes\n");
spin_unlock_irqrestore(&dma_domain->domain_lock, flags);
return -EINVAL;