Re: [PATCH 2/3] hugetlb: take hugetlb vma_lock when clearing vma_lock->vma pointer
From: Miaohe Lin
Date: Fri Oct 14 2022 - 21:33:16 EST
On 2022/10/6 11:30, Mike Kravetz wrote:
> To address build issues:
>
>
>>From b6d359f77d32c7734fe4f00806a0ed1e99925534 Mon Sep 17 00:00:00 2001
> From: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
> Date: Wed, 5 Oct 2022 20:26:19 -0700
> Subject: [PATCH 2/3] hugetlb: take hugetlb vma_lock when clearing
> vma_lock->vma pointer
>
> hugetlb file truncation/hole punch code may need to back out and take
> locks in order in the routine hugetlb_unmap_file_folio(). This code
> could race with vma freeing as pointed out in [1] and result in
> accessing a stale vma pointer. To address this, take the vma_lock when
> clearing the vma_lock->vma pointer.
>
> [1] https://lore.kernel.org/linux-mm/01f10195-7088-4462-6def-909549c75ef4@xxxxxxxxxx/
>
> Fixes: "hugetlb: use new vma_lock for pmd sharing synchronization"
> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
This patch looks good to me. Thanks.
Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
Thanks,
Miaohe Lin