diff options
| author | I Hsin Cheng <[email protected]> | 2024-05-26 14:01:39 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-06-25 05:25:04 +0000 |
| commit | 7abcb84f953df037d40fad66f2109db318dd155b (patch) | |
| tree | 1cd5ef60431a65ba37789a26e977658b2e059a7c /lib/plist.c | |
| parent | selftests: introduce additional eventfd test coverage (diff) | |
| download | kernel-7abcb84f953df037d40fad66f2109db318dd155b.tar.gz kernel-7abcb84f953df037d40fad66f2109db318dd155b.zip | |
lib/plist.c: enforce memory ordering in plist_check_list
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/[email protected]
Signed-off-by: I Hsin Cheng <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/plist.c')
| -rw-r--r-- | lib/plist.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/plist.c b/lib/plist.c index 0d86ed7a76ac..2e51829d3db9 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -47,8 +47,8 @@ static void plist_check_list(struct list_head *top) 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); } } |
