mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
userfaultfd: shmem: lock the page before adding it to pagecache
A VM_BUG_ON triggered on the shmem selftest. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Andrea Arcangeli <[email protected]> Cc: "Dr. David Alan Gilbert" <[email protected]> Cc: Hillf Danton <[email protected]> Cc: Michael Rapoport <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Pavel Emelyanov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
419624daf0
commit
9cc90c664a
1 changed files with 5 additions and 0 deletions
|
|
@ -2245,6 +2245,10 @@ int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm,
|
|||
*pagep = NULL;
|
||||
}
|
||||
|
||||
VM_BUG_ON(PageLocked(page) || PageSwapBacked(page));
|
||||
__SetPageLocked(page);
|
||||
__SetPageSwapBacked(page);
|
||||
|
||||
ret = mem_cgroup_try_charge(page, dst_mm, gfp, &memcg, false);
|
||||
if (ret)
|
||||
goto out_release;
|
||||
|
|
@ -2294,6 +2298,7 @@ out_release_uncharge_unlock:
|
|||
out_release_uncharge:
|
||||
mem_cgroup_cancel_charge(page, memcg, false);
|
||||
out_release:
|
||||
unlock_page(page);
|
||||
put_page(page);
|
||||
out_dec_used_blocks:
|
||||
if (sbinfo->max_blocks)
|
||||
|
|
|
|||
Loading…
Reference in a new issue