Skip to content

Commit

Permalink
[PATCH] Don't map the same page too much
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Oct 11, 2005
1 parent 9149ccf commit f5154a9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/fremap.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit f5154a9

Please sign in to comment.