diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-10-12 23:56:42 (GMT) |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-12-04 20:34:33 (GMT) |
commit | 2f073848c3cc8aff2655ab7c46d8c0de90cf4e50 (patch) | |
tree | a30a9e1b6f0edd5d1837c214cbf26c762fdb0a54 | |
parent | 7d86dccf28a3ae2f790f399fc82d4c82521fd078 (diff) | |
download | linux-2f073848c3cc8aff2655ab7c46d8c0de90cf4e50.tar.xz |
list: Use WRITE_ONCE() when initializing list_head structures
Code that does lockless emptiness testing of non-RCU lists is relying
on INIT_LIST_HEAD() to write the list head's ->next pointer atomically,
particularly when INIT_LIST_HEAD() is invoked from list_del_init().
This commit therefore adds WRITE_ONCE() to this function's pointer stores
that could affect the head's ->next pointer.
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | include/linux/list.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index 06c2d88..5356f4d 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -24,7 +24,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list) { - list->next = list; + WRITE_ONCE(list->next, list); list->prev = list; } |