From: Paul E. McKenney Date: Mon, 12 Oct 2015 23:56:42 +0000 (-0700) Subject: list: Use WRITE_ONCE() when initializing list_head structures X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2f073848c3cc8aff2655ab7c46d8c0de90cf4e50;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Paul E. McKenney --- diff --git a/include/linux/list.h b/include/linux/list.h index 06c2d887a918..5356f4d661a7 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; }