[PATCH] um: protect VMA iteration

Johannes Berg johannes at sipsolutions.net
Mon Oct 17 02:06:30 PDT 2022


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

Looks like this is needed now, otherwise we get RCU
splats from lockdep. But I don't know anything about
this code ...

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..3cc6b753e579 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);
 
+	rcu_read_lock();
 	for_each_vma(vmi, vma)
 		fix_range(mm, vma->vm_start, vma->vm_end, 0);
+	rcu_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);
 
+	rcu_read_lock();
 	for_each_vma(vmi, vma)
 		fix_range(mm, vma->vm_start, vma->vm_end, 1);
+	rcu_read_unlock();
 }
-- 
2.37.3




More information about the linux-um mailing list