summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorVarun Sethi <Varun.Sethi@freescale.com>2013-08-15 18:55:32 (GMT)
committerRivera Jose-B46482 <German.Rivera@freescale.com>2013-08-27 18:45:50 (GMT)
commitd31ab8884b031d63f82f9946c7bf7aaf235c9260 (patch)
tree492f2bc7b37b8c6d48ab10cc001f8005947f8cc1 /drivers/iommu
parent1f8783124e8be23a5d6941c640ab1538d3cd589b (diff)
downloadlinux-fsl-qoriq-d31ab8884b031d63f82f9946c7bf7aaf235c9260.tar.xz
Check for valid window before proceeding to set the stash or the omi attribute.
Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com> Change-Id: I6bbad9f1f1240fa23ae6997f5a0cdc6cb49228e1 Reviewed-on: http://git.am.freescale.net:8181/4035 Reviewed-by: Yoder Stuart-B08248 <stuart.yoder@freescale.com> Reviewed-by: Rivera Jose-B46482 <German.Rivera@freescale.com> Tested-by: Rivera Jose-B46482 <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/iommu')
-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;