]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcu: use WRITE_ONCE() for ->next and ->pprev of hlist_nulls
authorXuanqiang Luo <luoxuanqiang@kylinos.cn>
Wed, 5 Nov 2025 20:19:57 +0000 (12:19 -0800)
committerFrederic Weisbecker <frederic@kernel.org>
Wed, 5 Nov 2025 23:03:06 +0000 (00:03 +0100)
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>
include/linux/rculist_nulls.h

index 89186c499dd4721dd374864f7d193c2cd0fd8c73..d5a656cc4c6afbcb27710066348043d0f22e3773 100644 (file)
@@ -138,7 +138,7 @@ static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n,
 
        if (last) {
                WRITE_ONCE(n->next, last->next);
-               n->pprev = &last->next;
+               WRITE_ONCE(n->pprev, &last->next);
                rcu_assign_pointer(hlist_nulls_next_rcu(last), n);
        } else {
                hlist_nulls_add_head_rcu(n, h);
@@ -148,8 +148,8 @@ static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n,
 /* after that hlist_nulls_del will work */
 static inline void hlist_nulls_add_fake(struct hlist_nulls_node *n)
 {
-       n->pprev = &n->next;
-       n->next = (struct hlist_nulls_node *)NULLS_MARKER(NULL);
+       WRITE_ONCE(n->pprev, &n->next);
+       WRITE_ONCE(n->next, (struct hlist_nulls_node *)NULLS_MARKER(NULL));
 }
 
 /**