diff --git a/include/linux/mm.h b/include/linux/mm.h index 1a64ab7ba67a..ba42e189790e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1758,6 +1758,12 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, #ifdef CONFIG_SPECULATIVE_PAGE_FAULT static inline void vm_write_begin(struct vm_area_struct *vma) { + /* + * Isolated vma might be freed without exclusive mmap_lock but + * speculative page fault handler still needs to know it was changed. + */ + if (!RB_EMPTY_NODE(&vma->vm_rb)) + mmap_assert_write_locked(vma->vm_mm); /* * The reads never spins and preemption * disablement is not required.