# Re: \[PATCH 07/15\] hugetlbfs: fix unmapping folios from private VMAs

- From: Muchun Song \<muchun.song@linux.dev\>
- Date: 2026-10-30 09:40:03 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2026/10/17831795
- Thread: https://ratatoskr.run/linux-mm/2026/10/17823029/t.md

```text


> On Oct 29, 2026, at 04:13, David Hildenbrand (Arm) [ref] wrote:
> 
> From: Josef Bacik <josef@toxicpanda.com>
> 
> hugetlb_unmap_file_folio() assumes vm_private_data points to a struct
> hugetlb_vma_lock when hugetlb_vma_trylock_write() fails. Since hugetlb VMA
> locking was extended to private VMAs, this can also happen when
> vm_private_data contains a resv_map pointer; treating it as a
> hugetlb_vma_lock corrupts memory and can cause crashes or hangs.
> 
> Only take the VMA lock when a shareable lock exists, as additional locking
> is only needed for PMD table sharing. The fault mutex and i_mmap_rwsem
> already provide the required protection for private VMAs.
> 
> Fix generated by an LLM and sent by Josef Bacik in private.
> 
> Fixes: bf4916922c60 ("hugetlbfs: extend hugetlb_vma_lock to private VMAs")
> Cc: stable@kernel.org
> Tested-by: Daehyeon Ko <redacted>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> [ david: simplify description and comment ]
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>

Acked-by: Muchun Song <muchun.song@linux.dev>

Thanks.

```
