[Devel] [PATCH vz9] ms/trace/osnoise: fix missing put_online_cpus() on error path

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Tue Dec 28 17:42:48 MSK 2021


This is a backport of upstream commit 4b6b08f2e45e ("tracing/osnoise:
Fix missed cpus_read_unlock() in start_per_cpu_kthreads()").

It fixes broken error patch that returns without calling
put_online_cpus() to pair previously called get_online_cpus().

Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 kernel/trace/trace_osnoise.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 624419da31eb..b05f1a4a7d95 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1548,7 +1548,7 @@ static int start_kthread(unsigned int cpu)
 static int start_per_cpu_kthreads(struct trace_array *tr)
 {
 	struct cpumask *current_mask = &save_cpumask;
-	int retval;
+	int retval = 0;
 	int cpu;
 
 	get_online_cpus();
@@ -1568,13 +1568,14 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 		retval = start_kthread(cpu);
 		if (retval) {
 			stop_per_cpu_kthreads();
-			return retval;
+			goto out;
 		}
 	}
 
+out:
 	put_online_cpus();
 
-	return 0;
+	return retval;
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-- 
2.30.2



More information about the Devel mailing list