]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - mm/memory.c
Encode huge page size for VM_FAULT_HWPOISON errors
[mirror_ubuntu-zesty-kernel.git] / mm / memory.c
index 71b161b73bb503be50556e9ff302ca0c7eaba396..c2d6dd315659907211f10fe1849b42d951b9ddca 100644 (file)
@@ -1450,7 +1450,8 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
                                        if (ret & VM_FAULT_OOM)
                                                return i ? i : -ENOMEM;
                                        if (ret &
-                                           (VM_FAULT_HWPOISON|VM_FAULT_SIGBUS))
+                                           (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE|
+                                            VM_FAULT_SIGBUS))
                                                return i ? i : -EFAULT;
                                        BUG();
                                }
@@ -2680,10 +2681,12 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
        delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
 
        /*
-        * Make sure try_to_free_swap didn't release the swapcache
-        * from under us. The page pin isn't enough to prevent that.
+        * Make sure try_to_free_swap or reuse_swap_page or swapoff did not
+        * release the swapcache from under us.  The page pin, and pte_same
+        * test below, are not enough to exclude that.  Even if it is still
+        * swapcache, we need to check that the page's swap has not changed.
         */
-       if (unlikely(!PageSwapCache(page)))
+       if (unlikely(!PageSwapCache(page) || page_private(page) != entry.val))
                goto out_page;
 
        if (ksm_might_need_to_copy(page, vma, address)) {