mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
BACKPORT: FROMLIST: userfaultfd/hugetlbfs: Fix minor fault page leak
When uffd-minor enabled, we need to put the page cache before handling the
userfault in hugetlb_no_page(), otherwise the page refcount got leaked.
This can be reproduced by running userfaultfd selftest with hugetlb_shared
mode, then cat /proc/meminfo.
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Fixes: f2bf15fb0969 ("userfaultfd: add minor fault registration mode")
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
Link: https://lore.kernel.org/patchwork/patch/1400632/
Conflicts: mm/hugetlb.c
(manual rebase)
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Bug: 160737021
Bug: 169683130
Change-Id: Iac0ebd6738af8b6212c5a6303e4ee2f482bb5841
This commit is contained in:
parent
30cd89e371
commit
baf24c949a
1 changed files with 1 additions and 0 deletions
|
|
@ -4119,6 +4119,7 @@ retry:
|
|||
/* Check for page in userfault range. */
|
||||
if (userfaultfd_minor(vma)) {
|
||||
unlock_page(page);
|
||||
put_page(page);
|
||||
ret = hugetlb_handle_userfault(vma, mapping, h,
|
||||
idx, flags, haddr,
|
||||
VM_UFFD_MINOR);
|
||||
|
|
|
|||
Loading…
Reference in a new issue