diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-11-14 17:31:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 19:32:17 -0500 |
commit | f84c914b986ed2ec4ffaa5672b423b1f6b65519d (patch) | |
tree | c7bbfffe5499be53b9faf6364a5aeb90bf1ffdbb | |
parent | 7251ab6b86179f195b3f4b56d57ce9dc7a725409 (diff) |
m68k: handle pgtable_page_ctor() fail
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/m68k/include/asm/mcf_pgalloc.h | 4 | ||||
-rw-r--r-- | arch/m68k/include/asm/motorola_pgalloc.h | 8 | ||||
-rw-r--r-- | arch/m68k/include/asm/sun3_pgalloc.h | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 313f3dd23cdc..f9924fbcfe42 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h | |||
@@ -56,6 +56,10 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, | |||
56 | 56 | ||
57 | if (!page) | 57 | if (!page) |
58 | return NULL; | 58 | return NULL; |
59 | if (!pgtable_page_ctor(page)) { | ||
60 | __free_page(page); | ||
61 | return NULL; | ||
62 | } | ||
59 | 63 | ||
60 | pte = kmap(page); | 64 | pte = kmap(page); |
61 | if (pte) { | 65 | if (pte) { |
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h index 2f02f264e694..24bcba496c75 100644 --- a/arch/m68k/include/asm/motorola_pgalloc.h +++ b/arch/m68k/include/asm/motorola_pgalloc.h | |||
@@ -29,18 +29,22 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | |||
29 | 29 | ||
30 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) | 30 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
31 | { | 31 | { |
32 | struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | 32 | struct page *page; |
33 | pte_t *pte; | 33 | pte_t *pte; |
34 | 34 | ||
35 | page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | ||
35 | if(!page) | 36 | if(!page) |
36 | return NULL; | 37 | return NULL; |
38 | if (!pgtable_page_ctor(page)) { | ||
39 | __free_page(page); | ||
40 | return NULL; | ||
41 | } | ||
37 | 42 | ||
38 | pte = kmap(page); | 43 | pte = kmap(page); |
39 | __flush_page_to_ram(pte); | 44 | __flush_page_to_ram(pte); |
40 | flush_tlb_kernel_page(pte); | 45 | flush_tlb_kernel_page(pte); |
41 | nocache_page(pte); | 46 | nocache_page(pte); |
42 | kunmap(page); | 47 | kunmap(page); |
43 | pgtable_page_ctor(page); | ||
44 | return page; | 48 | return page; |
45 | } | 49 | } |
46 | 50 | ||
diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 48d80d5a666f..f868506e3350 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h | |||
@@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, | |||
59 | return NULL; | 59 | return NULL; |
60 | 60 | ||
61 | clear_highpage(page); | 61 | clear_highpage(page); |
62 | pgtable_page_ctor(page); | 62 | if (!pgtable_page_ctor(page)) { |
63 | __free_page(page); | ||
64 | return NULL; | ||
65 | } | ||
63 | return page; | 66 | return page; |
64 | 67 | ||
65 | } | 68 | } |