From: Jon Derrick Date: Tue, 31 Dec 2019 20:24:19 +0000 (-0700) Subject: iommu: Remove device link to group on failure X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7d4e6ccd1fb09dbfbc49746ca82bd5c25ad4bfe4;p=linux.git iommu: Remove device link to group on failure This adds the missing teardown step that removes the device link from the group when the device addition fails. Signed-off-by: Jon Derrick Fixes: 797a8b4d768c5 ("iommu: Handle default domain attach failure") Reviewed-by: Lu Baolu Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index fdd40756dbc15..3ead597e1c570 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -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: