Commit cb407fc8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull MIPS fix from Thomas Bogendoerfer:
 "Fix PMD accounting change"

* tag 'mips-fixes_5.14_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
  MIPS: check return value of pgtable_pmd_page_ctor
parents 894d6f40 6aa32467
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -58,15 +58,20 @@ do { \

static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
	pmd_t *pmd = NULL;
	pmd_t *pmd;
	struct page *pg;

	pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
	if (pg) {
		pgtable_pmd_page_ctor(pg);
	pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_ORDER);
	if (!pg)
		return NULL;

	if (!pgtable_pmd_page_ctor(pg)) {
		__free_pages(pg, PMD_ORDER);
		return NULL;
	}

	pmd = (pmd_t *)page_address(pg);
	pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
	}
	return pmd;
}