]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2020 18:48:20 +0000 (19:48 +0100)
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>
drivers/iommu/iommu.c

index 24248aa8a7e58804af68e3c7532735b547ce04e9..cd3c0ea56657e1e2593c91cd8c8254b08f03b4c9 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: