aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-09-21 01:02:17 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-11-23 13:37:35 -0500
commit1c97be677f72b3c338312aecd36d8fff20322f32 (patch)
tree805643267b5d6cc61c8dd168c4610c554cd76a68 /lib
parent6cf10081220ae21175a867d446b3167bcbcb937b (diff)
list: Use WRITE_ONCE() when adding to lists and hlists
Code that does lockless emptiness testing of non-RCU lists is relying on the list-addition code to write the list head's ->next pointer atomically. This commit therefore adds WRITE_ONCE() to list-addition pointer stores that could affect the head's ->next pointer. Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/list_debug.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/list_debug.c b/lib/list_debug.c
index c24c2f7e296f..3859bf63561c 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -37,7 +37,7 @@ void __list_add(struct list_head *new,
37 next->prev = new; 37 next->prev = new;
38 new->next = next; 38 new->next = next;
39 new->prev = prev; 39 new->prev = prev;
40 prev->next = new; 40 WRITE_ONCE(prev->next, new);
41} 41}
42EXPORT_SYMBOL(__list_add); 42EXPORT_SYMBOL(__list_add);
43 43