Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcu: use WRITE_ONCE() for ->next and ->pprev of hlist_nulls

In rculist_nulls.h we can still see ordinary assignments to ->pprev and
->next of hlist_nulls.

As noted in the two patches below:
commit efd04f8a8b45 ("rcu: Use WRITE_ONCE() for assignments to ->next for
rculist_nulls")
commit 860c8802ace1 ("rcu: Use WRITE_ONCE() for assignments to ->pprev for
hlist_nulls")

We should use WRITE_ONCE().

Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

authored by

Xuanqiang Luo and committed by
Frederic Weisbecker
34e82569 e52b4388

+3 -3
+3 -3
include/linux/rculist_nulls.h
··· 138 138 139 139 if (last) { 140 140 WRITE_ONCE(n->next, last->next); 141 - n->pprev = &last->next; 141 + WRITE_ONCE(n->pprev, &last->next); 142 142 rcu_assign_pointer(hlist_nulls_next_rcu(last), n); 143 143 } else { 144 144 hlist_nulls_add_head_rcu(n, h); ··· 148 148 /* after that hlist_nulls_del will work */ 149 149 static inline void hlist_nulls_add_fake(struct hlist_nulls_node *n) 150 150 { 151 - n->pprev = &n->next; 152 - n->next = (struct hlist_nulls_node *)NULLS_MARKER(NULL); 151 + WRITE_ONCE(n->pprev, &n->next); 152 + WRITE_ONCE(n->next, (struct hlist_nulls_node *)NULLS_MARKER(NULL)); 153 153 } 154 154 155 155 /**