Commit 37641ef
hugetlb: check for anon_vma prior to folio allocation
Commit 9acad7b ("hugetlb: use vmf_anon_prepare() instead of
anon_vma_prepare()") may bailout after allocating a folio if we do not
hold the mmap lock. When this occurs, vmf_anon_prepare() will release the
vma lock. Hugetlb then attempts to call restore_reserve_on_error(), which
depends on the vma lock being held.
We can move vmf_anon_prepare() prior to the folio allocation in order to
avoid calling restore_reserve_on_error() without the vma lock.
Link: https://lkml.kernel.org/r/ZiFqSrSRLhIV91og@fedora
Fixes: 9acad7b ("hugetlb: use vmf_anon_prepare() instead of anon_vma_prepare()")
Reported-by: syzbot+ad1b592fc4483655438b@syzkaller.appspotmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 682886e commit 37641ef
1 file changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6261 | 6261 | | |
6262 | 6262 | | |
6263 | 6263 | | |
| 6264 | + | |
| 6265 | + | |
| 6266 | + | |
| 6267 | + | |
| 6268 | + | |
| 6269 | + | |
6264 | 6270 | | |
6265 | 6271 | | |
6266 | 6272 | | |
| |||
6297 | 6303 | | |
6298 | 6304 | | |
6299 | 6305 | | |
| 6306 | + | |
6300 | 6307 | | |
6301 | 6308 | | |
6302 | 6309 | | |
6303 | 6310 | | |
6304 | 6311 | | |
6305 | | - | |
6306 | | - | |
6307 | | - | |
6308 | | - | |
6309 | 6312 | | |
6310 | 6313 | | |
6311 | 6314 | | |
| |||
0 commit comments