[PATCH] MIPS: check return value of pgtable_pmd_page_ctor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+. According to Documentation/vm/split_page_table_lock, handle failure
of pgtable_pmd_page_ctor

+. use GFP_KERNEL_ACCOUNT instead of GFP_KERNEL|__GFP_ACCOUNT

Reported-by: Joshua Kinard <kumba@xxxxxxxxxx>
Signed-off-by: Huang Pei <huangpei@xxxxxxxxxxx>
---
 arch/mips/include/asm/pgalloc.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index d0cf997b4ba8..5c9597a6c60c 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -62,11 +62,15 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 	pmd_t *pmd = NULL;
 	struct page *pg;
 
-	pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
+	pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_ORDER);
 	if (pg) {
-		pgtable_pmd_page_ctor(pg);
-		pmd = (pmd_t *)page_address(pg);
-		pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
+		if(pgtable_pmd_page_ctor(pg)) {
+			pmd = (pmd_t *)page_address(pg);
+			pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
+		} else {
+			__free_pages(pg, PMD_ORDER);
+		}
+
 	}
 	return pmd;
 }
-- 
2.25.1




[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux