diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2019-12-23 04:55:50 +0100 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-02-21 00:58:21 +0100 |
commit | 24bb9eccf7ff335c16c2970ac7cd5c32a92821a6 (patch) | |
tree | 149776c467fb08dc619d26f77565ac3b90b31a8d /kernel/rcu/tree_exp.h | |
parent | rcu: Warn on for_each_leaf_node_cpu_mask() from non-leaf (diff) | |
download | linux-24bb9eccf7ff335c16c2970ac7cd5c32a92821a6.tar.xz linux-24bb9eccf7ff335c16c2970ac7cd5c32a92821a6.zip |
rcu: Fix exp_funnel_lock()/rcu_exp_wait_wake() datarace
The rcu_node structure's ->exp_seq_rq field is accessed locklessly, so
updates must use WRITE_ONCE(). This commit therefore adds the needed
WRITE_ONCE() invocation where it was missed.
This data race was reported by KCSAN. Not appropriate for backporting
due to failure being unlikely.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu/tree_exp.h')
-rw-r--r-- | kernel/rcu/tree_exp.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index dcbd75791f39..d7e04849c7ab 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -589,7 +589,7 @@ static void rcu_exp_wait_wake(unsigned long s) spin_lock(&rnp->exp_lock); /* Recheck, avoid hang in case someone just arrived. */ if (ULONG_CMP_LT(rnp->exp_seq_rq, s)) - rnp->exp_seq_rq = s; + WRITE_ONCE(rnp->exp_seq_rq, s); spin_unlock(&rnp->exp_lock); } smp_mb(); /* All above changes before wakeup. */ |