iommu: Remove device link to group on failure
authorJon Derrick <jonathan.derrick@intel.com>
Tue, 31 Dec 2019 20:24:19 +0000 (13:24 -0700)
committerJoerg Roedel <jroedel@suse.de>
Tue, 7 Jan 2020 16:08:57 +0000 (17:08 +0100)
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>
drivers/iommu/iommu.c

index fdd4075..3ead597 100644 (file)
@@ -751,6 +751,7 @@ err_put_group:
        mutex_unlock(&group->mutex);
        dev->iommu_group = NULL;
        kobject_put(group->devices_kobj);
+       sysfs_remove_link(group->devices_kobj, device->name);
 err_free_name:
        kfree(device->name);
 err_remove_link: