xtensa: handle pgtable_page_ctor() fail
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 14 Nov 2013 22:31:48 +0000 (14:31 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Nov 2013 00:32:19 +0000 (09:32 +0900)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/xtensa/include/asm/pgalloc.h

index 037671a655dcd07d1e09c4d0710d331083077891..b8774f1e21e65650c5a09fc14f9498f5d6d90464 100644 (file)
@@ -58,7 +58,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
        if (!pte)
                return NULL;
        page = virt_to_page(pte);
-       pgtable_page_ctor(page);
+       if (!pgtable_page_ctor(page)) {
+               kmem_cache_free(pgtable_cache, pte);
+               return NULL;
+       }
        return page;
 }