* [PATCH] powerpc/perf: vpa-dtl: fix resource leak on allocation failure
@ 2026-11-12 13:44 mdshahid03
0 siblings, 0 replies; only message in thread
From: mdshahid03 @ 2026-11-12 13:44 UTC (permalink / raw)
To: maddy
Cc: mpe, npiggin, chleroy, ritesh.list, sshegde, linuxppc-dev,
linux-kernel, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
vpa_dtl_event_init acquires dtl_access_lock when initializing the
first vpa_dtl PMU event.
If vpa_dtl_mem_alloc() fails,the function returns -ENOMEM without
releasing the semaphore.
Release the semaphore when buffer allocation fails and no other
PMU events are active.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
arch/powerpc/perf/vpa-dtl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/perf/vpa-dtl.c b/arch/powerpc/perf/vpa-dtl.c
index 3e3d65b6c796..20eafeaffa6b 100644
--- a/arch/powerpc/perf/vpa-dtl.c
+++ b/arch/powerpc/perf/vpa-dtl.c
@@ -396,6 +396,8 @@ static int vpa_dtl_event_init(struct perf_event *event)
/* Allocate dtl buffer memory */
if (vpa_dtl_mem_alloc(event->cpu)) {
+ if (dtl_global_refc == 0)
+ up_write(&dtl_access_lock);
spin_unlock(&dtl_global_lock);
return -ENOMEM;
}
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-12 13:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 13:44 [PATCH] powerpc/perf: vpa-dtl: fix resource leak on allocation failure mdshahid03
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®