Skip to content

Commit c51f83c

Browse files
committed
rcu: Use READ_ONCE() for ->expmask in rcu_read_unlock_special()
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: [email protected] Signed-off-by: Paul E. McKenney <[email protected]> Acked-by: Marco Elver <[email protected]>
1 parent 3717e1e commit c51f83c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/rcu/tree_plugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ static void rcu_read_unlock_special(struct task_struct *t)
599599
struct rcu_node *rnp = rdp->mynode;
600600

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

0 commit comments

Comments
 (0)