aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-10-11 14:16:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-11 15:03:47 -0400
commitf5154a98a1931641f0448f6512294a15279110d7 (patch)
treefd5ea19514d07338f58b2df4b2f87922b9975a04
parent9149ccfa3571eaa4a4b444777d67fc4ed3ebcf27 (diff)
[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>
-rw-r--r--mm/fremap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index 3235fb77c133..ab23a0673c35 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -89,6 +89,9 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
89 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 89 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
90 if (!page->mapping || page->index >= size) 90 if (!page->mapping || page->index >= size)
91 goto err_unlock; 91 goto err_unlock;
92 err = -ENOMEM;
93 if (page_mapcount(page) > INT_MAX/2)
94 goto err_unlock;
92 95
93 zap_pte(mm, vma, addr, pte); 96 zap_pte(mm, vma, addr, pte);
94 97