From: Kirill A. Shutemov Date: Thu, 14 Nov 2013 22:31:30 +0000 (-0800) Subject: frv: handle pgtable_page_ctor() fail X-Git-Tag: firefly_0821_release~176^2~4971^2~44 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3b9cf77d1aad657dd44ab0f0368978e87b64ad23;p=firefly-linux-kernel-4.4.55.git frv: handle pgtable_page_ctor() fail Signed-off-by: Kirill A. Shutemov Acked-by: David Howells Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c index f6084bc524e8..41907d25ed38 100644 --- a/arch/frv/mm/pgalloc.c +++ b/arch/frv/mm/pgalloc.c @@ -37,11 +37,15 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) #else page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); #endif - if (page) { - clear_highpage(page); - pgtable_page_ctor(page); - flush_dcache_page(page); + if (!page) + return NULL; + + clear_highpage(page); + if (!pgtable_page_ctor(page)) { + __free_page(page); + return NULL; } + flush_dcache_page(page); return page; }