--- x/mm/mremap.c +++ y/mm/mremap.c @@ -1823,7 +1823,7 @@ static unsigned long remap_move(struct v unsigned long target_addr = new_addr; unsigned long res = -EFAULT; unsigned long last_end; - bool seen_vma = false; + bool seen_vma = false, allowed; VMA_ITERATOR(vmi, current->mm, start); @@ -1865,7 +1865,8 @@ static unsigned long remap_move(struct v vrm->new_addr = target_addr + offset; vrm->old_len = vrm->new_len = len; - if (!vma_multi_allowed(vma)) { + allowed = vma_multi_allowed(vma); + if (!allowed) { /* This is not the first VMA, abort immediately. */ if (seen_vma) return -EFAULT; @@ -1881,7 +1882,7 @@ static unsigned long remap_move(struct v return res_vma; if (!seen_vma) { - VM_WARN_ON_ONCE(vma_multi_allowed(vma) && + VM_WARN_ON_ONCE(allowed && res_vma != new_addr); res = res_vma; }