Skip to content

Commit

Permalink
m68k: handle pgtable_page_ctor() fail
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill A. Shutemov <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kiryl authored and torvalds committed Nov 15, 2013
1 parent 7251ab6 commit f84c914
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions arch/m68k/include/asm/mcf_pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,

if (!page)
return NULL;
if (!pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}

pte = kmap(page);
if (pte) {
Expand Down
8 changes: 6 additions & 2 deletions arch/m68k/include/asm/motorola_pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,22 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)

static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
struct page *page;
pte_t *pte;

page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
if(!page)
return NULL;
if (!pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}

pte = kmap(page);
__flush_page_to_ram(pte);
flush_tlb_kernel_page(pte);
nocache_page(pte);
kunmap(page);
pgtable_page_ctor(page);
return page;
}

Expand Down
5 changes: 4 additions & 1 deletion arch/m68k/include/asm/sun3_pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
return NULL;

clear_highpage(page);
pgtable_page_ctor(page);
if (!pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}
return page;

}
Expand Down

0 comments on commit f84c914

Please sign in to comment.