Messages in this thread Patch in this message | | | From | Usama Arif <> | Subject | [PATCH] mm: hugetlb: Only prep and add allocated folios for non-gigantic pages | Date | Mon, 9 Oct 2023 15:56:05 +0100 |
| |
Calling prep_and_add_allocated_folios when allocating gigantic pages at boot time causes the kernel to crash as folio_list is empty and iterating it causes a NULL pointer dereference. Call this only for non-gigantic pages when folio_list has entires.
Fixes: bfb41d6b2fe148 ("hugetlb: restructure pool allocations") Signed-off-by: Usama Arif <usama.arif@bytedance.com> --- mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f3749fc125d4..b12f5fd295bb 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3397,7 +3397,8 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h) } /* list will be empty if hstate_is_gigantic */ - prep_and_add_allocated_folios(h, &folio_list); + if (!hstate_is_gigantic(h)) + prep_and_add_allocated_folios(h, &folio_list); if (i < h->max_huge_pages) { char buf[32]; -- 2.25.1
| |