mm: numa: ensure anon_vma is locked to prevent parallel THP splits
[platform/adaptation/renesas_rcar/renesas_kernel.git] / mm / huge_memory.c
index 420826e..dbafffa 100644 (file)
@@ -1359,6 +1359,13 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
                goto out_unlock;
        }
 
+       /* Bail if we fail to protect against THP splits for any reason */
+       if (unlikely(!anon_vma)) {
+               put_page(page);
+               page_nid = -1;
+               goto clear_pmdnuma;
+       }
+
        /*
         * Migrate the THP to the requested node, returns with page unlocked
         * and pmd_numa cleared.