aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-02-04 23:08:43 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-02-04 23:08:43 -0800
commitdfceb6d66939565cbccf6379de8a87daefd0c92c (patch)
treeb3b6cb69503e0fdd927b66916bd3a4f095e2da28
parentf69229f575d96cbd0ba28927b734e11fdfe3b51c (diff)
downloadhistory-dfceb6d66939565cbccf6379de8a87daefd0c92c.tar.gz
[PATCH] tmpfs caused truncate BUG
Just before removing truncate_complete_page's BUG_ON(page_mapped(page)), thought I'd recheck on a few filesystems. The shame! Easily triggered with tmpfs: not because of recent changes, but because shmem_nopage omitted the i_size_read from Andrea's careful truncate_count/i_size_read /cachelookup/truncate_count sequence. For varying reasons, other users of shmem_getpage can't go beyond i_size, so just add it to shmem_nopage. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/shmem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index c34e131967a917..c8fa573e030d9b 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1162,6 +1162,8 @@ struct page *shmem_nopage(struct vm_area_struct *vma, unsigned long address, int
idx = (address - vma->vm_start) >> PAGE_SHIFT;
idx += vma->vm_pgoff;
idx >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
+ if (((loff_t) idx << PAGE_CACHE_SHIFT) >= i_size_read(inode))
+ return NOPAGE_SIGBUS;
error = shmem_getpage(inode, idx, &page, SGP_CACHE, type);
if (error)