summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/dmar.c
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2021-05-25 15:08:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-03 08:59:00 +0200
commit044bbe8b92ab4e542de7f6c93c88ea65cccd8e29 (patch)
tree406b62562d88e5ddf025d5a66f8b26692fe3e0dd /drivers/iommu/dmar.c
parentaba3c7795f51717ae316f3566442dee7cc3eeccb (diff)
downloadlinux-stable-044bbe8b92ab4e542de7f6c93c88ea65cccd8e29.tar.gz
linux-stable-044bbe8b92ab4e542de7f6c93c88ea65cccd8e29.tar.bz2
linux-stable-044bbe8b92ab4e542de7f6c93c88ea65cccd8e29.zip
iommu/vt-d: Fix sysfs leak in alloc_iommu()
commit 0ee74d5a48635c848c20f152d0d488bf84641304 upstream. iommu_device_sysfs_add() is called before, so is has to be cleaned on subsequent errors. Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device") Cc: stable@vger.kernel.org # 4.11.x Signed-off-by: Rolf Eike Beer <eb@emlix.com> Acked-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/17411490.HIIP88n32C@mobilepool36.emlix.com Link: https://lore.kernel.org/r/20210525070802.361755-2-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iommu/dmar.c')
-rw-r--r--drivers/iommu/dmar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 1b9795743276..24616525c90d 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1110,7 +1110,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
err = iommu_device_register(&iommu->iommu);
if (err)
- goto err_unmap;
+ goto err_sysfs;
}
drhd->iommu = iommu;
@@ -1118,6 +1118,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
return 0;
+err_sysfs:
+ iommu_device_sysfs_remove(&iommu->iommu);
err_unmap:
unmap_iommu(iommu);
error_free_seq_id: