[PATCH 1/9] coresight: cpu-debug: Fix PM usage counter leak in debug_enable_func()
From: James Clark
Date: Tue Oct 27 2026 - 11:01:03 EST
pm_runtime_get_sync() increments the usage counter even when it fails,
but the failing CPU isn't added to the rollback mask, so its reference
is never dropped. Use pm_runtime_resume_and_get() which drops the
reference itself on failure.
Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/bug/linux-2ff60e6d-33ac-4a69-9c62-63eb482f1913
Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-cpu-debug.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 3a806c1d50ea..06e55dfa6b91 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -429,7 +429,7 @@ static int debug_enable_func(void)
if (!drvdata)
continue;
- ret = pm_runtime_get_sync(drvdata->dev);
+ ret = pm_runtime_resume_and_get(drvdata->dev);
if (ret < 0)
goto err;
else
@@ -440,7 +440,7 @@ static int debug_enable_func(void)
err:
/*
- * If pm_runtime_get_sync() has failed, need rollback on
+ * If pm_runtime_resume_and_get() has failed, need rollback on
* all the other CPUs that have been enabled before that.
*/
for_each_cpu(cpu, &mask) {
--
2.43.0