public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/x86/intel/uncore: Fix iounmap() leak on global_init failure
@ 2026-01-13  0:25 Zide Chen
  2026-01-13  0:48 ` Mi, Dapeng
  2026-01-13 16:21 ` Markus Elfring
  0 siblings, 2 replies; 7+ messages in thread
From: Zide Chen @ 2026-01-13  0:25 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
	Andi Kleen, Eranian Stephane
  Cc: linux-kernel, linux-perf-users, Dapeng Mi, Zide Chen, Xudong Hao,
	Falcon Thomas, kernel test robot

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@intel.com>
Fixes: b575fc0e3357 ("perf/x86/intel/uncore: Add domain global init callback")
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-14 19:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13  0:25 [PATCH] perf/x86/intel/uncore: Fix iounmap() leak on global_init failure Zide Chen
2026-01-13  0:48 ` Mi, Dapeng
2026-01-13 16:21 ` Markus Elfring
2026-01-13 22:04   ` Chen, Zide
2026-01-14  7:25     ` Markus Elfring
2026-01-14  7:51     ` Markus Elfring
2026-01-14 19:41       ` Chen, Zide

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox