From: Jon Derrick jonathan.derrick@intel.com
commit 7d4e6ccd1fb09dbfbc49746ca82bd5c25ad4bfe4 upstream.
This adds the missing teardown step that removes the device link from the group when the device addition fails.
Signed-off-by: Jon Derrick jonathan.derrick@intel.com Fixes: 797a8b4d768c5 ("iommu: Handle default domain attach failure") Reviewed-by: Lu Baolu baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel jroedel@suse.de Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org Conflicts: drivers/iommu/iommu.c [yyl: adjust context]
Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/iommu/iommu.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 361ceee..ca63b7a 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -689,6 +689,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev) dev->iommu_group = NULL; kobject_put(group->devices_kobj); kfree(dev->iommu_param); + sysfs_remove_link(group->devices_kobj, device->name); err_free_name: kfree(device->name); err_remove_link: