Commit f5154a98 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

[PATCH] Don't map the same page too much

Refuse to install a page into a mapping if the mapping count is already
ridiculously large.

You probably cannot trigger this on 32-bit architectures, but on a
64-bit setup we should protect against it.
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9149ccfa
...@@ -89,6 +89,9 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -89,6 +89,9 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
if (!page->mapping || page->index >= size) if (!page->mapping || page->index >= size)
goto err_unlock; goto err_unlock;
err = -ENOMEM;
if (page_mapcount(page) > INT_MAX/2)
goto err_unlock;
zap_pte(mm, vma, addr, pte); zap_pte(mm, vma, addr, pte);
......
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