X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=mm%2Fmemory.c;h=0e18b4d649ec82abc83c208e5f9dce9cbb2cf905;hb=6e1bd1ab1d9ab8e83cdc940df82fbf8418e2593f;hp=71b161b73bb503be50556e9ff302ca0c7eaba396;hpb=df423dc7f2a801b9a45d7c501a8eb5c529455ea1;p=~andy%2Flinux diff --git a/mm/memory.c b/mm/memory.c index 71b161b73bb..0e18b4d649e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2680,10 +2680,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)) {