Skip to content

Commit

Permalink
rcu: Use READ_ONCE() for ->expmask in rcu_read_unlock_special()
Browse files Browse the repository at this point in the history
The rcu_node structure's ->expmask field is updated only when holding the
->lock, but is also accessed locklessly.  This means that all ->expmask
updates must use WRITE_ONCE() and all reads carried out without holding
->lock must use READ_ONCE().  This commit therefore changes the lockless
->expmask read in rcu_read_unlock_special() to use READ_ONCE().

Reported-by: syzbot+99f4ddade3c22ab0cf23@syzkaller.appspotmail.com
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Marco Elver <elver@google.com>
  • Loading branch information
Paul E. McKenney committed Jan 24, 2020
1 parent 3717e1e commit c51f83c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/rcu/tree_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static void rcu_read_unlock_special(struct task_struct *t)
struct rcu_node *rnp = rdp->mynode;

exp = (t->rcu_blocked_node && t->rcu_blocked_node->exp_tasks) ||
(rdp->grpmask & rnp->expmask) ||
(rdp->grpmask & READ_ONCE(rnp->expmask)) ||
tick_nohz_full_cpu(rdp->cpu);
// Need to defer quiescent state until everything is enabled.
if (irqs_were_disabled && use_softirq &&
Expand Down

0 comments on commit c51f83c

Please sign in to comment.