]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rcu: Protect rcu_check_gp_kthread_starvation() access to ->gp_flags
authorPaul E. McKenney <paulmck@linux.ibm.com>
Wed, 12 Dec 2018 15:20:07 +0000 (07:20 -0800)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Fri, 25 Jan 2019 23:29:58 +0000 (15:29 -0800)
The rcu_check_gp_kthread_starvation() function can be invoked without
holding locks, so the access to the rcu_state structure's ->gp_flags
field must be protected with READ_ONCE().  This commit therefore adds
this protection.

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

index 8543a90d53f2fa4b51938cad28d998abbd046a1c..238150684fedd2ac1b1dbcbb6b3efd999c05dfac 100644 (file)
@@ -1192,7 +1192,7 @@ static void rcu_check_gp_kthread_starvation(void)
                pr_err("%s kthread starved for %ld jiffies! g%ld f%#x %s(%d) ->state=%#lx ->cpu=%d\n",
                       rcu_state.name, j,
                       (long)rcu_seq_current(&rcu_state.gp_seq),
-                      rcu_state.gp_flags,
+                      READ_ONCE(rcu_state.gp_flags),
                       gp_state_getname(rcu_state.gp_state), rcu_state.gp_state,
                       gpk ? gpk->state : ~0, gpk ? task_cpu(gpk) : -1);
                if (gpk) {