[PATCH] perf/x86/intel/uncore: Fix iounmap() leak on global_init failure

From: Zide Chen

Date: Mon Jan 12 2026 - 19:35:01 EST


If domain->global_init() fails in __parse_discovery_table(), the
mapped MMIO region is not released before returning, resulting in
an iounmap() leak.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Fixes: b575fc0e3357 ("perf/x86/intel/uncore: Add domain global init callback")
Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
---
arch/x86/events/intel/uncore_discovery.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
index 0e414cecb6f2..f64661ad56b2 100644
--- a/arch/x86/events/intel/uncore_discovery.c
+++ b/arch/x86/events/intel/uncore_discovery.c
@@ -286,8 +286,10 @@ static int __parse_discovery_table(struct uncore_discovery_domain *domain,
if (!io_addr)
return -ENOMEM;

- if (domain->global_init && domain->global_init(global.ctl))
+ if (domain->global_init && domain->global_init(global.ctl)) {
+ iounmap(io_addr);
return -ENODEV;
+ }

/* Parsing Unit Discovery State */
for (i = 0; i < global.max_units; i++) {
--
2.52.0