Skip to contentSkip to conversation

iommu/vt-d: Fixes for v5.13-rc4

GIT PULL New Lu Baolu 1 participant 2 messages May 25, 2021

Subsystems (3)
lore
Share & tools
lore

Lu Baolu

author maintainer
#0 lore raw

Hi Joerg,

A small fix is queued for v5.13. It fixes:

- sysfs leak in alloc_iommu.

Please consider it for v5.13.

Best regards,
Lu Baolu

Rolf Eike Beer (1):
iommu/vt-d: Fix sysfs leak in alloc_iommu()

 drivers/iommu/intel/dmar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 6 lines
2.25.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
author maintainer
#1 lore raw

PATCH 1/1 iommu/vt-d: Fix sysfs leak in alloc_iommu()

From: Rolf Eike Beer <[email protected]>

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 [email protected] # 4.11.x
---
 drivers/iommu/intel/dmar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/intel/dmar.c +3 -1
index 1757ac1e1623..84057cb9596c 100644
@@ -1142,7 +1142,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 
 		err = iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL);
 		if (err)
-			goto err_unmap;
+			goto err_sysfs;
 	}
 
 	drhd->iommu = iommu;
@@ -1150,6 +1150,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:
Signature · 1 line
2.25.1