提交 4f804943 编写于 作者: K Kirill A. Shutemov 提交者: Linus Torvalds

powerpc: handle pgtable_page_ctor() fail

Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 bc16640d
...@@ -91,7 +91,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, ...@@ -91,7 +91,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
if (!pte) if (!pte)
return NULL; return NULL;
page = virt_to_page(pte); page = virt_to_page(pte);
pgtable_page_ctor(page); if (!pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}
return page; return page;
} }
......
...@@ -121,7 +121,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) ...@@ -121,7 +121,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
ptepage = alloc_pages(flags, 0); ptepage = alloc_pages(flags, 0);
if (!ptepage) if (!ptepage)
return NULL; return NULL;
pgtable_page_ctor(ptepage); if (!pgtable_page_ctor(ptepage)) {
__free_page(ptepage);
return NULL;
}
return ptepage; return ptepage;
} }
......
...@@ -378,6 +378,10 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel) ...@@ -378,6 +378,10 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel)
__GFP_REPEAT | __GFP_ZERO); __GFP_REPEAT | __GFP_ZERO);
if (!page) if (!page)
return NULL; return NULL;
if (!kernel && !pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}
ret = page_address(page); ret = page_address(page);
spin_lock(&mm->page_table_lock); spin_lock(&mm->page_table_lock);
...@@ -392,9 +396,6 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel) ...@@ -392,9 +396,6 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel)
} }
spin_unlock(&mm->page_table_lock); spin_unlock(&mm->page_table_lock);
if (!kernel)
pgtable_page_ctor(page);
return (pte_t *)ret; return (pte_t *)ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册