dect
/
linux-2.6
Archived
13
0
Fork 0

[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: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Hugh Dickins 2005-10-11 19:16:26 +01:00 committed by Linus Torvalds
parent 9149ccfa35
commit f5154a98a1
1 changed files with 3 additions and 0 deletions

View File

@ -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;
if (!page->mapping || page->index >= size)
goto err_unlock;
err = -ENOMEM;
if (page_mapcount(page) > INT_MAX/2)
goto err_unlock;
zap_pte(mm, vma, addr, pte);