Message ID | 20220614185456.14339-2-tim.gardner@canonical.com |
---|---|
State | New |
Headers | show |
Series | mm: rmap: explicitly reset vma->anon_vma in unlink_anon_vmas() | expand |
diff --git a/mm/rmap.c b/mm/rmap.c index 6d80e92688fe..24a9bf234010 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -401,8 +401,15 @@ void unlink_anon_vmas(struct vm_area_struct *vma) list_del(&avc->same_vma); anon_vma_chain_free(avc); } - if (vma->anon_vma) + if (vma->anon_vma) { vma->anon_vma->degree--; + + /* + * 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); /*