Skip to content

Commit bfeebe2

Browse files
committed
rcu: Add READ_ONCE() to rcu_segcblist ->tails[]
The rcu_segcblist structure's ->tails[] array entries are read locklessly, so this commit adds the READ_ONCE() to a load in order to avoid destructive compiler optimizations. This data race was reported by KCSAN. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 0050c7b commit bfeebe2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/rcu/rcu_segcblist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void rcu_segcblist_offload(struct rcu_segcblist *rsclp)
182182
bool rcu_segcblist_ready_cbs(struct rcu_segcblist *rsclp)
183183
{
184184
return rcu_segcblist_is_enabled(rsclp) &&
185-
&rsclp->head != rsclp->tails[RCU_DONE_TAIL];
185+
&rsclp->head != READ_ONCE(rsclp->tails[RCU_DONE_TAIL]);
186186
}
187187

188188
/*

0 commit comments

Comments
 (0)