mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 01:43:18 +00:00
This reverts commitea52cb24cd("mm/hugetlbfs: update hugetlbfs to use mmap_prepare") with conflict resolution to account for changes in commitea52cb24cd("mm/hugetlbfs: update hugetlbfs to use mmap_prepare"). The patch incorrectly handled hugetlb VMA lock allocation at the mmap_prepare stage, where a failed allocation occurring after mmap_prepare is called might result in the lock leaking. There is no risk of a merge causing a similar issues, as VMA_DONTEXPAND_BIT is set for hugetlb mappings. As a first step in addressing this issue, simply revert the change so we can rework how we do this having corrected the underlying issues. We maintain the VMA flags changes as best we can, accounting for the fact that we were working with a VMA descriptor previously and propagating like-for-like changes for this. Note that we invoke vma_set_flags() and do not call vma_start_write() as vm_flags_set() does. This is OK as it's being done in an .mmap hook where the VMA is not yet linked into the tree so nobody else can be accessing it. Link: https://lore.kernel.org/[email protected] Fixes:ea52cb24cd("mm/hugetlbfs: update hugetlbfs to use mmap_prepare") Signed-off-by: Lorenzo Stoakes <[email protected]> Reported-by: Mingyu Wang <[email protected]> Closes: https://lore.kernel.org/linux-mm/[email protected]/ Acked-by: Muchun Song <[email protected]> Acked-by: Oscar Salvador <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Liam R. Howlett <[email protected]> Cc: Pedro Falcato <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>