[PATCH v3] um: protect VMA iteration

Anton Ivanov anton.ivanov at cambridgegreys.com
Tue Oct 18 05:02:21 PDT 2022



On 18/10/2022 11:49, Johannes Berg wrote:
> 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

Happens even to the best of us.

> ---
>   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);
>   }
Acked-By: Anton Ivanov <anton.ivanov at cambridgegreys.com>
-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/



More information about the linux-um mailing list