From: Paul E. McKenney Date: Sat, 10 Jul 2021 00:53:27 +0000 (-0700) Subject: scftorture: Avoid NULL pointer exception on early exit X-Git-Tag: accepted/tizen/unified/20230118.172025~6579^2^6~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=586e4d4193a653eef21f02b50dee89e2e4be208c;p=platform%2Fkernel%2Flinux-rpi.git 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 --- diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 5cf40e4..64a0828 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