summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2014-09-04 17:27:29 -0500
committerJoerg Roedel <jroedel@suse.de>2014-09-05 15:31:05 +0200
commite3f595b9039c888016211c710eb1f58b3f60f809 (patch)
treeaff1744f04e68d4c75b471a135b9972c5e209b19 /drivers/iommu
parent69e273c0b0a3c337a521d083374c918dc52c666f (diff)
downloadlinux-e3f595b9039c888016211c710eb1f58b3f60f809.tar.gz
linux-e3f595b9039c888016211c710eb1f58b3f60f809.tar.bz2
linux-e3f595b9039c888016211c710eb1f58b3f60f809.zip
iommu/omap: Check for valid archdata in attach_dev
Any device requiring to be attached to an iommu_domain must have valid archdata containing the necessary iommu information, which is SoC-specific. Add a check in the omap_iommu_attach_dev to make sure that the device has valid archdata before accessing different SoC-specific fields of the archdata. This prevents a NULL pointer dereference on any misconfigured devices. Signed-off-by: Suman Anna <s-anna@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/omap-iommu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index e202b0c24120..b888b7a6dd4f 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1091,6 +1091,11 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
int ret = 0;
+ if (!arch_data || !arch_data->name) {
+ dev_err(dev, "device doesn't have an associated iommu\n");
+ return -EINVAL;
+ }
+
spin_lock(&omap_domain->lock);
/* only a single device is supported per domain for now */