Mike Kravetz e32905e573 userfaultfd: hugetlbfs: fix new flag usage in error path
In commit d6995da31122 ("hugetlb: use page.private for hugetlb specific
page flags") the use of PagePrivate to indicate a reservation count
should be restored at free time was changed to the hugetlb specific flag
HPageRestoreReserve.  Changes to a userfaultfd error path as well as a
VM_BUG_ON() in remove_inode_hugepages() were overlooked.

Users could see incorrect hugetlb reserve counts if they experience an
error with a UFFDIO_COPY operation.  Specifically, this would be the
result of an unlikely copy_huge_page_from_user error.  There is not an
increased chance of hitting the VM_BUG_ON.

Link: https://lkml.kernel.org/r/20210521233952.236434-1-mike.kravetz@oracle.com
Fixes: d6995da31122 ("hugetlb: use page.private for hugetlb specific page flags")
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Mina Almasry <almasry.mina@google.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-05-22 15:09:07 -10:00
..
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-05-07 00:26:35 -07:00
2021-02-24 13:38:27 -08:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-14 19:41:32 -07:00
2021-05-07 00:26:35 -07:00
2021-04-30 11:20:36 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:27 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:34 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-03-02 17:25:46 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-04-16 16:10:37 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:27 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:19 -07:00
2021-05-05 11:27:25 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:27 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00