check_anon_vma_clone(dst, src);
+ if (!src->anon_vma)
+ return 0;
+
list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) {
struct anon_vma *anon_vma;
mmap_assert_locked(vma->vm_mm);
/* Unfaulted is a no-op. */
- VM_WARN_ON_ONCE(!vma->anon_vma && !list_empty(&vma->anon_vma_chain));
+ if (!vma->anon_vma) {
+ VM_WARN_ON_ONCE(!list_empty(&vma->anon_vma_chain));
+ return;
+ }
/*
* Unlink each anon_vma chained to the VMA. This list is ordered
list_del(&avc->same_vma);
anon_vma_chain_free(avc);
}
- if (vma->anon_vma) {
- vma->anon_vma->num_active_vmas--;
- /*
- * vma would still be needed after unlink, and anon_vma will be prepared
- * when handle fault.
- */
- vma->anon_vma = NULL;
- }
+ vma->anon_vma->num_active_vmas--;
+ /*
+ * vma would still be needed after unlink, and anon_vma will be prepared
+ * when handle fault.
+ */
+ vma->anon_vma = NULL;
unlock_anon_vma_root(root);
/*