Skip to contentSkip to conversation

iommu/amd: Fix ivrs_base memleak in early_amd_iommu_init()

PATCH In review Zhen Ni 3 participants 3 messages Aug 22, 2025 – Sep 5, 2025

Subsystems (3)
lore
Share & tools
lore

Zhen Ni

author
#0 lore raw

PATCH 1/1 iommu/amd: Fix ivrs_base memleak in early_amd_iommu_init()

Fix a permanent ACPI table memory leak in early_amd_iommu_init() when CMPXCHG16B feature is not supported

Fixes 82582f85ed22 ("iommu/amd: Disable AMD IOMMU if CMPXCHG16B feature is not supported")
---
 drivers/iommu/amd/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +2 -1
index 7b5af6176de9..dddc432de7b0 100644
@@ -3067,7 +3067,8 @@ static int __init early_amd_iommu_init(void)
 
 	if (!boot_cpu_has(X86_FEATURE_CX16)) {
 		pr_err("Failed to initialize. The CMPXCHG16B feature is required.\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out;
 	}
 
 	/*
Signature · 1 line
2.20.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Zhen Ni

Fix a permanent ACPI table memory leak in early_amd_iommu_init() when CMPXCHG16B feature is not supported

Fixes 82582f85ed22 ("iommu/amd: Disable AMD IOMMU if CMPXCHG16B feature is not supported")
---
  drivers/iommu/amd/init.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +0 -0
index 7b5af6176de9..dddc432de7b0 100644

drivers/iommu/amd/init.c static int __init early_amd_iommu_init(void) · line 3074

Quoted 9 lines
drivers/iommu/amd/init.c +2 -1
@@ -3067,7 +3067,8 @@ static int __init early_amd_iommu_init(void)
 
  	if (!boot_cpu_has(X86_FEATURE_CX16)) {
  		pr_err("Failed to initialize. The CMPXCHG16B feature is required.\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out;
  	}
 
  	/*

Thanks,
Suravee

maintainer
#2 lore raw
In reply to Zhen Ni
Quoted 9 lines · Zhen Ni

Fix a permanent ACPI table memory leak in early_amd_iommu_init() when CMPXCHG16B feature is not supported

Fixes 82582f85ed22 ("iommu/amd: Disable AMD IOMMU if CMPXCHG16B feature is not supported")
---
 drivers/iommu/amd/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied for -rc, thanks.