diff options
author | Joerg Roedel <jroedel@suse.de> | 2016-04-04 15:47:48 +0200 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2016-04-07 14:33:03 +0200 |
commit | eebb8034a5be8c2177cbf07ca2ecd2ff8a058958 (patch) | |
tree | 0cdbfb78a24c1e68a679cb9d5006e4afcb0e5735 /drivers/iommu/iommu.c | |
parent | 07b48ac4bbe527e68cfc555f2b2b206908437141 (diff) | |
download | linux-eebb8034a5be8c2177cbf07ca2ecd2ff8a058958.tar.bz2 |
iommu: Don't overwrite domain pointer when there is no default_domain
IOMMU drivers that do not support default domains, but make
use of the the group->domain pointer can get that pointer
overwritten with NULL on device add/remove.
Make sure this can't happen by only overwriting the domain
pointer when it is NULL.
Cc: stable@vger.kernel.org # v4.4+
Fixes: 1228236de5f9 ('iommu: Move default domain allocation to iommu_group_get_for_dev()')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r-- | drivers/iommu/iommu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index bfd4f7c3b1d8..b9df1411c894 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -848,7 +848,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) if (!group->default_domain) { group->default_domain = __iommu_domain_alloc(dev->bus, IOMMU_DOMAIN_DMA); - group->domain = group->default_domain; + if (!group->domain) + group->domain = group->default_domain; } ret = iommu_group_add_device(group, dev); |