Skip to content

Commit

Permalink
scftorture: Avoid NULL pointer exception on early exit
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
paulmckrcu committed Jul 27, 2021
1 parent 9b9a806 commit 586e4d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/scftorture.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 586e4d4

Please sign in to comment.