The patch titled Subject: lib/plist.c: enforce memory ordering in plist_check_list has been added to the -mm mm-nonmm-unstable branch. Its filename is lib-plistc-enforce-memory-ordering-in-plist_check_list.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-plistc-enforce-memory-ordering-in-plist_check_list.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: I Hsin Cheng <richard120310@xxxxxxxxx> Subject: lib/plist.c: enforce memory ordering in plist_check_list Date: Sun, 26 May 2024 22:01:39 +0800 There exists an iteration over a plist in plist_check_list(), and memory dependency exists between variables "prev", "next" and "prev->next". As plist is used in the scheduling subsystem, we should guarantee the memory ordering between multiple processors. Using macro "WRITE_ONCE()" can help us to ensure the memory ordering as it was stated in "Documentation/memory-barriers.txt". Link: https://lkml.kernel.org/r/20240526140139.17220-1-richard120310@xxxxxxxxx Signed-off-by: I Hsin Cheng <richard120310@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/plist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/lib/plist.c~lib-plistc-enforce-memory-ordering-in-plist_check_list +++ a/lib/plist.c @@ -47,8 +47,8 @@ static void plist_check_list(struct list plist_check_prev_next(top, prev, next); while (next != top) { - prev = next; - next = prev->next; + WRITE_ONCE(prev, next); + WRITE_ONCE(next, prev->next); plist_check_prev_next(top, prev, next); } } _ Patches currently in -mm which might be from richard120310@xxxxxxxxx are lib-plistc-enforce-memory-ordering-in-plist_check_list.patch