When VMAs are split/merged, the maple tree node may be replaced.
Re-walk the tree in such cases by calling mas_pause().
Fixes: a88fae9a5fc2 (userfaultfd: use maple tree iterator to iterate
VMAs)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
((struct vm_userfaultfd_ctx){ ctx }),
anon_vma_name(vma));
if (prev) {
+ /* vma_merge() invalidated the mas */
+ mas_pause(&mas);
vma = prev;
goto next;
}
ret = split_vma(mm, vma, start, 1);
if (ret)
break;
+ /* split_vma() invalidated the mas */
+ mas_pause(&mas);
}
if (vma->vm_end > end) {
ret = split_vma(mm, vma, end, 0);
if (ret)
break;
+ /* split_vma() invalidated the mas */
+ mas_pause(&mas);
}
next:
/*