diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-11-14 17:31:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 19:32:19 -0500 |
commit | 1ae9ae5f7df726c67736c643c1f03f7bdfe748eb (patch) | |
tree | ea4172be40418472c7172de9f8d6e0796a846467 | |
parent | 478cf8ca013f9e33be978dee4d0a15906e5a030a (diff) |
sparc: handle pgtable_page_ctor() fail
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>
-rw-r--r-- | arch/sparc/mm/init_64.c | 11 | ||||
-rw-r--r-- | arch/sparc/mm/srmmu.c | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index ed82edad1a39..d6de9353ee11 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -2519,12 +2519,13 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, | |||
2519 | return pte; | 2519 | return pte; |
2520 | 2520 | ||
2521 | page = __alloc_for_cache(mm); | 2521 | page = __alloc_for_cache(mm); |
2522 | if (page) { | 2522 | if (!page) |
2523 | pgtable_page_ctor(page); | 2523 | return NULL; |
2524 | pte = (pte_t *) page_address(page); | 2524 | if (!pgtable_page_ctor(page)) { |
2525 | free_hot_cold_page(page, 0); | ||
2526 | return NULL; | ||
2525 | } | 2527 | } |
2526 | 2528 | return (pte_t *) page_address(page); | |
2527 | return pte; | ||
2528 | } | 2529 | } |
2529 | 2530 | ||
2530 | void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | 2531 | void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 5d721df48a72..869023abe5a4 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c | |||
@@ -345,7 +345,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) | |||
345 | if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0) | 345 | if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0) |
346 | return NULL; | 346 | return NULL; |
347 | page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); | 347 | page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); |
348 | pgtable_page_ctor(page); | 348 | if (!pgtable_page_ctor(page)) { |
349 | __free_page(page); | ||
350 | return NULL; | ||
351 | } | ||
349 | return page; | 352 | return page; |
350 | } | 353 | } |
351 | 354 | ||