[PATCH v3] um: protect VMA iteration

Johannes Berg johannes at sipsolutions.net
Tue Oct 18 03:49:49 PDT 2022


From: Johannes Berg <johannes.berg at intel.com>

Due to changes in the iteration, there are now lockdep
checks indicating that we're missing locking here. Add
the missing locking where it's needed.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
v2: use mmap_read_lock()
v3: umm, yeah I'm an idiot, tested without rebuilding
---
 arch/um/kernel/tlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index ad449173a1a1..fa43bcd9ba0b 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -597,6 +597,8 @@ void force_flush_all(void)
 	struct vm_area_struct *vma;
 	VMA_ITERATOR(vmi, mm, 0);
 
+	mmap_read_lock(mm);
 	for_each_vma(vmi, vma)
 		fix_range(mm, vma->vm_start, vma->vm_end, 1);
+	mmap_read_unlock(mm);
 }
-- 
2.37.3




More information about the linux-um mailing list