[PATCH v2] um: protect VMA iteration
Johannes Berg
johannes at sipsolutions.net
Tue Oct 18 03:19:48 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. Fix
that.
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
arch/um/kernel/tlb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index ad449173a1a1..2a5e266c3ed4 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -587,8 +587,10 @@ void flush_tlb_mm(struct mm_struct *mm)
struct vm_area_struct *vma;
VMA_ITERATOR(vmi, mm, 0);
+ mmap_read_lock();
for_each_vma(vmi, vma)
fix_range(mm, vma->vm_start, vma->vm_end, 0);
+ mmap_read_unlock();
}
void force_flush_all(void)
@@ -597,6 +599,8 @@ void force_flush_all(void)
struct vm_area_struct *vma;
VMA_ITERATOR(vmi, mm, 0);
+ mmap_read_lock();
for_each_vma(vmi, vma)
fix_range(mm, vma->vm_start, vma->vm_end, 1);
+ mmap_read_unlock();
}
--
2.37.3
More information about the linux-um
mailing list