tile: handle pgtable_page_ctor() fail
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 14 Nov 2013 22:31:43 +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>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/tile/mm/pgtable.c

index 4fd9ec0b58edcb57d0b3346d41eea54c6f66c35f..5e86eac4bfae572da1c65ce268b8572ce91a9c42 100644 (file)
@@ -241,6 +241,11 @@ struct page *pgtable_alloc_one(struct mm_struct *mm, unsigned long address,
        if (p == NULL)
                return NULL;
 
+       if (!pgtable_page_ctor(p)) {
+               __free_pages(p, L2_USER_PGTABLE_ORDER);
+               return NULL;
+       }
+
        /*
         * Make every page have a page_count() of one, not just the first.
         * We don't use __GFP_COMP since it doesn't look like it works
@@ -251,7 +256,6 @@ struct page *pgtable_alloc_one(struct mm_struct *mm, unsigned long address,
                inc_zone_page_state(p+i, NR_PAGETABLE);
        }
 
-       pgtable_page_ctor(p);
        return p;
 }