Commit 76dd2a8f authored by Michael Ellerman's avatar Michael Ellerman Committed by Linus Torvalds

[PATCH] Fix oops in alloc_zeroed_user_highpage() when page is NULL

The generic and IA-64 versions of alloc_zeroed_user_highpage() don't
check the return value from alloc_page_vma().  This can lead to an oops
if we're OOM.

This fixes my oops on PPC64, but I haven't got an IA-64 machine/compiler
handy.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3d230060
...@@ -79,7 +79,8 @@ do { \ ...@@ -79,7 +79,8 @@ do { \
#define alloc_zeroed_user_highpage(vma, vaddr) \ #define alloc_zeroed_user_highpage(vma, vaddr) \
({ \ ({ \
struct page *page = alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr); \ struct page *page = alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr); \
flush_dcache_page(page); \ if (page) \
flush_dcache_page(page); \
page; \ page; \
}) })
......
...@@ -48,7 +48,9 @@ alloc_zeroed_user_highpage(struct vm_area_struct *vma, unsigned long vaddr) ...@@ -48,7 +48,9 @@ alloc_zeroed_user_highpage(struct vm_area_struct *vma, unsigned long vaddr)
{ {
struct page *page = alloc_page_vma(GFP_HIGHUSER, vma, vaddr); struct page *page = alloc_page_vma(GFP_HIGHUSER, vma, vaddr);
clear_user_highpage(page, vaddr); if (page)
clear_user_highpage(page, vaddr);
return page; return page;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment