sparc: handle pgtable_page_ctor() fail
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 14 Nov 2013 22:31:42 +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: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/sparc/mm/init_64.c
arch/sparc/mm/srmmu.c

index ed82edad1a392864dd3919ce2010b8a0474e8f15..d6de9353ee118de51f7a1948b8ab3b4d366b3b44 100644 (file)
@@ -2519,12 +2519,13 @@ pgtable_t pte_alloc_one(struct mm_struct *mm,
                return pte;
 
        page = __alloc_for_cache(mm);
-       if (page) {
-               pgtable_page_ctor(page);
-               pte = (pte_t *) page_address(page);
+       if (!page)
+               return NULL;
+       if (!pgtable_page_ctor(page)) {
+               free_hot_cold_page(page, 0);
+               return NULL;
        }
-
-       return pte;
+       return (pte_t *) page_address(page);
 }
 
 void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
index 5d721df48a72d10dfe56095e0a8cf67d258fd7f9..869023abe5a4440c3ec08777e987c7abcc9777b8 100644 (file)
@@ -345,7 +345,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
        if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0)
                return NULL;
        page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT);
-       pgtable_page_ctor(page);
+       if (!pgtable_page_ctor(page)) {
+               __free_page(page);
+               return NULL;
+       }
        return page;
 }