summaryrefslogtreecommitdiff
path: root/kernel/scftorture.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2021-07-10 03:53:27 +0300
committerPaul E. McKenney <paulmck@kernel.org>2021-07-27 21:39:30 +0300
commit586e4d4193a653eef21f02b50dee89e2e4be208c (patch)
tree659518c2f70f26f70869ed082aaaf9f5128b4c05 /kernel/scftorture.c
parent9b9a80677fd80bd531cb05bfe205a40a51955939 (diff)
downloadlinux-586e4d4193a653eef21f02b50dee89e2e4be208c.tar.xz
scftorture: Avoid NULL pointer exception on early exit
When scftorture finds an error in the module parameters controlling the relative frequencies of smp_call_function*() variants, it takes an early exit. So early that it has not allocated memory to track the kthreads running the test, which results in a segfault. This commit therefore checks for the existence of the memory before attempting to stop the kthreads that would otherwise have been recorded in that non-existent memory. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/scftorture.c')
-rw-r--r--kernel/scftorture.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 5cf40e438319..64a08288b1a6 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -513,7 +513,7 @@ static void scf_torture_cleanup(void)
return;
WRITE_ONCE(scfdone, true);
- if (nthreads)
+ if (nthreads && scf_stats_p)
for (i = 0; i < nthreads; i++)
torture_stop_kthread("scftorture_invoker", scf_stats_p[i].task);
else