diff options
author | Suman Anna <s-anna@ti.com> | 2014-09-04 17:27:29 -0500 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-09-05 15:31:05 +0200 |
commit | e3f595b9039c888016211c710eb1f58b3f60f809 (patch) | |
tree | aff1744f04e68d4c75b471a135b9972c5e209b19 /drivers/iommu/omap-iommu.c | |
parent | 69e273c0b0a3c337a521d083374c918dc52c666f (diff) | |
download | op-kernel-dev-e3f595b9039c888016211c710eb1f58b3f60f809.zip op-kernel-dev-e3f595b9039c888016211c710eb1f58b3f60f809.tar.gz |
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/omap-iommu.c')
-rw-r--r-- | drivers/iommu/omap-iommu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index e202b0c..b888b7a 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 */ |