]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - mm/huge_memory.c
thp: avoid dumping huge zero page
[~shefty/rdma-dev.git] / mm / huge_memory.c
index 6001ee6347a9694f4a9b31ef9060913ff30440bf..b5783d81eda90fc9a808478ac6dcea4f74b4424e 100644 (file)
@@ -1257,6 +1257,10 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
        if (flags & FOLL_WRITE && !pmd_write(*pmd))
                goto out;
 
+       /* Avoid dumping huge zero page */
+       if ((flags & FOLL_DUMP) && is_huge_zero_pmd(*pmd))
+               return ERR_PTR(-EFAULT);
+
        page = pmd_page(*pmd);
        VM_BUG_ON(!PageHead(page));
        if (flags & FOLL_TOUCH) {