Commit ecfbd73
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@huawei.com/
[mike.kravetz@oracle.com: address build issues]
Link: https://lkml.kernel.org/r/Yz5L1uxQYR1VqFtJ@monkey
Link: https://lkml.kernel.org/r/20221005011707.514612-3-mike.kravetz@oracle.com
Fixes: "hugetlb: use new vma_lock for pmd sharing synchronization"
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: James Houghton <jthoughton@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Prakash Sangappa <prakash.sangappa@oracle.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 131a79b commit ecfbd73
1 file changed
Lines changed: 32 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
5188 | 5189 | | |
5189 | 5190 | | |
5190 | 5191 | | |
5191 | | - | |
5192 | | - | |
| 5192 | + | |
5193 | 5193 | | |
5194 | 5194 | | |
5195 | 5195 | | |
| |||
6828 | 6828 | | |
6829 | 6829 | | |
6830 | 6830 | | |
| 6831 | + | |
| 6832 | + | |
| 6833 | + | |
| 6834 | + | |
| 6835 | + | |
| 6836 | + | |
| 6837 | + | |
| 6838 | + | |
| 6839 | + | |
| 6840 | + | |
| 6841 | + | |
| 6842 | + | |
| 6843 | + | |
| 6844 | + | |
| 6845 | + | |
| 6846 | + | |
| 6847 | + | |
| 6848 | + | |
| 6849 | + | |
| 6850 | + | |
| 6851 | + | |
| 6852 | + | |
| 6853 | + | |
| 6854 | + | |
6831 | 6855 | | |
6832 | 6856 | | |
6833 | 6857 | | |
| |||
6839 | 6863 | | |
6840 | 6864 | | |
6841 | 6865 | | |
6842 | | - | |
6843 | | - | |
6844 | | - | |
6845 | | - | |
6846 | | - | |
6847 | | - | |
6848 | | - | |
6849 | | - | |
| 6866 | + | |
| 6867 | + | |
6850 | 6868 | | |
6851 | 6869 | | |
6852 | 6870 | | |
| |||
6997 | 7015 | | |
6998 | 7016 | | |
6999 | 7017 | | |
| 7018 | + | |
| 7019 | + | |
| 7020 | + | |
| 7021 | + | |
7000 | 7022 | | |
7001 | 7023 | | |
7002 | 7024 | | |
| |||
0 commit comments