diff options
| author | Steve Sistare <[email protected]> | 2024-09-03 14:25:21 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-09-26 21:01:43 +0000 |
| commit | ce645b9fdc78ec5d28067286e92871ddae6817d5 (patch) | |
| tree | 6138bc81e2ee99b0a471fcd9ba1c0e5e9ecab782 /drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |
| parent | mm/gup: fix memfd_pin_folios hugetlb page allocation (diff) | |
| download | kernel-ce645b9fdc78ec5d28067286e92871ddae6817d5.tar.gz kernel-ce645b9fdc78ec5d28067286e92871ddae6817d5.zip | |
mm/gup: fix memfd_pin_folios alloc race panic
If memfd_pin_folios tries to create a hugetlb page, but someone else
already did, then folio gets the value -EEXIST here:
folio = memfd_alloc_folio(memfd, start_idx);
if (IS_ERR(folio)) {
ret = PTR_ERR(folio);
if (ret != -EEXIST)
goto err;
then on the next trip through the "while start_idx" loop we panic here:
if (folio) {
folio_put(folio);
To fix, set the folio to NULL on error.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios")
Signed-off-by: Steve Sistare <[email protected]>
Acked-by: Vivek Kasireddy <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c')
0 files changed, 0 insertions, 0 deletions
