From: Josh Triplett Date: Sun, 1 Sep 2013 23:42:52 +0000 (-0700) Subject: rcu: Make rcu_assign_pointer's assignment volatile and type-safe X-Git-Tag: v3.14-rc1~174^2^2^4~1 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=9d162cd06349dfee6b4f254b3abf1355cf0aee43;p=linux.git rcu: Make rcu_assign_pointer's assignment volatile and type-safe The rcu_assign_pointer() primitive needs to use ACCESS_ONCE to make the assignment to the destination pointer volatile, to protect against compilers too clever for their own good. Signed-off-by: Josh Triplett Signed-off-by: Paul E. McKenney --- diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 00ad28168ef0..97853cd2d7b4 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -551,7 +551,7 @@ static inline void rcu_preempt_sleep_check(void) #define __rcu_assign_pointer(p, v, space) \ do { \ smp_wmb(); \ - (p) = (typeof(*v) __force space *)(v); \ + ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \ } while (0)