frv: handle pgtable_page_ctor() fail
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 14 Nov 2013 22:31:30 +0000 (14:31 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Nov 2013 00:32:17 +0000 (09:32 +0900)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/frv/mm/pgalloc.c

index f6084bc524e85e578487d34dea06f0e23b4a8214..41907d25ed384e2ee42e46d1df461bbd2886732f 100644 (file)
@@ -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;
 }