From: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Date: Wed, 29 Oct 2014 22:39:39 +0000 (-0700) Subject: rcu: Protect rcu_boost() lockless accesses with ACCESS_ONCE() X-Git-Tag: firefly_0821_release~176^2~2265^2^2~1^3~13 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b08ea27d95bcaee6d9cf4edd64f373006661424a;p=firefly-linux-kernel-4.4.55.git rcu: Protect rcu_boost() lockless accesses with ACCESS_ONCE() This commit prevents random compiler optimizations by applying ACCESS_ONCE() to lockless accesses. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> --- diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 3ec85cb5d544..d59913ef8360 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -1127,7 +1127,8 @@ static int rcu_boost(struct rcu_node *rnp) struct task_struct *t; struct list_head *tb; - if (rnp->exp_tasks == NULL && rnp->boost_tasks == NULL) + if (ACCESS_ONCE(rnp->exp_tasks) == NULL && + ACCESS_ONCE(rnp->boost_tasks) == NULL) return 0; /* Nothing left to boost. */ raw_spin_lock_irqsave(&rnp->lock, flags);