rcutorture: Fix rcu_torture_cbflood() for callback-free RCU
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 23 Jun 2015 01:11:31 +0000 (18:11 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 15 Jul 2015 21:47:17 +0000 (14:47 -0700)
The rcu_torture_cbflood() function correctly checks for flavors of
RCU that lack analogs to call_rcu() and rcu_barrier(), but in that
case it fails to terminate correctly.  In fact, it terminates so
incorrectly that segfaults can result.  This commit therefore causes
rcu_torture_cbflood() to do the proper wait-for-stop procedure.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/rcutorture.c

index 1cead7806ca607233b4f95dd2771016251ee78e4..e0eda3c1b621acf28c8e96aee4a79fd438f2b2e8 100644 (file)
@@ -823,9 +823,7 @@ rcu_torture_cbflood(void *arg)
        }
        if (err) {
                VERBOSE_TOROUT_STRING("rcu_torture_cbflood disabled: Bad args or OOM");
-               while (!torture_must_stop())
-                       schedule_timeout_interruptible(HZ);
-               return 0;
+               goto wait_for_stop;
        }
        VERBOSE_TOROUT_STRING("rcu_torture_cbflood task started");
        do {
@@ -844,6 +842,7 @@ rcu_torture_cbflood(void *arg)
                stutter_wait("rcu_torture_cbflood");
        } while (!torture_must_stop());
        vfree(rhp);
+wait_for_stop:
        torture_kthread_stopping("rcu_torture_cbflood");
        return 0;
 }