Intel IOMMU: fix sysfs leak in hotplug init path
Subsystems (2)
PATCH 1/1 Intel IOMMU: fix sysfs leak in hotplug init path
--- drivers/iommu/intel/dmar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
I have not actually tested this but I guess it should match the code in free_iommu() just below.
drivers/iommu/intel/dmar.c +3 -1
@@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) err =iommu_device_register (&iommu->iommu);if (err) - goto err_unmap; + goto err_unregister; } drhd->iommu = iommu;
@@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)return 0 ; +err_unregister: +iommu_device_sysfs_remove (&iommu->iommu); err_unmap:unmap_iommu (iommu); error_free_seq_id:
Signature · 11 lines
2.31.1 -- Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source
Lu Baolu
maintainerHi Rolf,
Quoted 1 line · Rolf Eike Beer
Signed-off-by Rolf Eike Beer <[email protected]>
Thanks for the patch!
Can you please adjust the subject to "iommu/vt-d: Fix sysfs leak in alloc_domain()"? It's not only for hotplug path.
Please also add commit message.
Add below Fixes tag as well:
Quoted 22 lines
--- drivers/iommu/intel/dmar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)I have not actually tested this but I guess it should match the code in
free_iommu()just below.drivers/iommu/intel/dmar.c +1
-1@@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) err =iommu_device_register (&iommu->iommu);if (err) - goto err_unmap; + goto err_unregister; } drhd->iommu = iommu;
drivers/iommu/intel/dmar.c static int alloc_iommu(struct dmar_drhd_unit *drhd) · line 1159
Quoted 8 lines
drivers/iommu/intel/dmar.c +2
-0@@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)return 0 ; +err_unregister: +iommu_device_sysfs_remove (&iommu->iommu); err_unmap:unmap_iommu (iommu); error_free_seq_id:
Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 1/1 iommu/vt-d: Fix sysfs leak in alloc_domain()
In reply to Rolf Eike Beeriommu_device_sysfs_add() is called before, so is has to be cleaned on subsequent errors.
--- drivers/iommu/intel/dmar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/intel/dmar.c +3 -1
@@ -1144,7 +1144,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;
@@ -1152,6 +1152,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 · 10 lines
2.31.1 -- Rolf Eike Beer, emlix GmbH, https://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source
Re: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
Hi Rolf,
Quoted 6 lines · Rolf Eike Beer
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.xSigned-off-by Rolf Eike Beer <[email protected]>
P.S. Next time when you submit a new version, please use a version tag.
Best regards,
baolu
Quoted 27 lines
--- drivers/iommu/intel/dmar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/iommu/intel/dmar.c +3
-1@@ -1144,7 +1144,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;@@ -1152,6 +1152,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:
Re: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
Am Donnerstag, 22. April 2021, 07:34:17 CEST schrieb Lu Baolu:
Quoted 11 lines
Hi Rolf,
Quoted 6 lines · Rolf Eike Beer
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.xSigned-off-by Rolf Eike Beer <[email protected]>Acked-by Lu Baolu <[email protected]>
Ping. Who is going to pick this up, please?
Eike
Signature · 7 lines
Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Lu Baolu
maintainerRe: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
Hi Joerg,
Quoted 7 lines · Rolf Eike Beer
Am Donnerstag, 22. April 2021, 07:34:17 CEST schrieb Lu Baolu:
Quoted 6 lines
Hi Rolf,
Quoted 3 lines · Rolf Eike Beer
iommu_device_sysfs_add()is called before, so is has to be cleaned on subsequent errors.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Fixes 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")Cc [email protected] # 4.11.xSigned-off-by Rolf Eike Beer <[email protected]>Acked-by Lu Baolu <[email protected]>Ping. Who is going to pick this up, please?
I forgot to put this fix in my last pull request. Could you please pick it up? Or, I can send another pull request the next week.
Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu