diff options
author | Robin Murphy <robin.murphy@arm.com> | 2016-11-11 17:59:23 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:48 (GMT) |
commit | 8f9e09e185cdbe7ec9385a785fffb65a04ec7a99 (patch) | |
tree | ae09039ca2f41c05d126411590cfaf5d81cabda4 /drivers/iommu | |
parent | 1ae209047950c7868223df693bf19e9433b76153 (diff) | |
download | linux-8f9e09e185cdbe7ec9385a785fffb65a04ec7a99.tar.xz |
iommu/amd: Fix group refcounting
If acpihid_device_group() finds an existing group for the relevant
devid, it should be taking an additional reference on that group.
Otherwise, the caller of iommu_group_get_for_dev() will inadvertently
remove the reference taken by iommu_group_add_device(), and the group
will be freed prematurely if any device is removed.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/amd_iommu.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 4b22b88..f471717 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -373,6 +373,8 @@ static struct iommu_group *acpihid_device_group(struct device *dev) if (!entry->group) entry->group = generic_device_group(dev); + else + iommu_group_ref_get(entry->group); return entry->group; } |