Skip to content

Commit 93ee385

Browse files
linuswRussell King (Oracle)
authored andcommitted
ARM: 9431/1: mm: Pair atomic_set_release() with _read_acquire()
The code for syncing vmalloc memory PGD pointers is using atomic_read() in pair with atomic_set_release() but the proper pairing is atomic_read_acquire() paired with atomic_set_release(). This is done to clearly instruct the compiler to not reorder the memcpy() or similar calls inside the section so that we do not observe changes to init_mm. memcpy() calls should be identified by the compiler as having unpredictable side effects, but let's try to be on the safe side. Cc: [email protected] Fixes: d31e23a ("ARM: mm: make vmalloc_seq handling SMP safe") Suggested-by: Mark Rutland <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent 44e9a3b commit 93ee385

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm/mm/ioremap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void __check_vmalloc_seq(struct mm_struct *mm)
141141
int seq;
142142

143143
do {
144-
seq = atomic_read(&init_mm.context.vmalloc_seq);
144+
seq = atomic_read_acquire(&init_mm.context.vmalloc_seq);
145145
memcpy_pgd(mm, VMALLOC_START, VMALLOC_END);
146146
if (IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
147147
unsigned long start =

0 commit comments

Comments
 (0)