diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2008-03-19 20:01:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-19 21:53:36 -0400 |
commit | 08ca0db8aa2db4ddcf487d46d85dc8ffb22162cc (patch) | |
tree | 3cb882dd0bc473bcb397752c9894d35ec0a918d7 /fs/isofs/compress.c | |
parent | a6b91919e0881a0d0a4ae5211d5c879a8c7ca92b (diff) |
zisofs: fix readpage() outside i_size
A read request outside i_size will be handled in do_generic_file_read(). So
we just return 0 to avoid getting -EIO as normal reading, let
do_generic_file_read do the rest.
At the same time we need unlock the page to avoid system stuck.
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=10227
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Acked-by: Jan Kara <jack@suse.cz>
Report-by: Christian Perle <chris@linuxinfotag.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/isofs/compress.c')
-rw-r--r-- | fs/isofs/compress.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c index 37dbd6404787..defb932eee9a 100644 --- a/fs/isofs/compress.c +++ b/fs/isofs/compress.c | |||
@@ -72,6 +72,17 @@ static int zisofs_readpage(struct file *file, struct page *page) | |||
72 | offset = index & ~zisofs_block_page_mask; | 72 | offset = index & ~zisofs_block_page_mask; |
73 | blockindex = offset >> zisofs_block_page_shift; | 73 | blockindex = offset >> zisofs_block_page_shift; |
74 | maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 74 | maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
75 | |||
76 | /* | ||
77 | * If this page is wholly outside i_size we just return zero; | ||
78 | * do_generic_file_read() will handle this for us | ||
79 | */ | ||
80 | if (page->index >= maxpage) { | ||
81 | SetPageUptodate(page); | ||
82 | unlock_page(page); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
75 | maxpage = min(zisofs_block_pages, maxpage-offset); | 86 | maxpage = min(zisofs_block_pages, maxpage-offset); |
76 | 87 | ||
77 | for ( i = 0 ; i < maxpage ; i++, offset++ ) { | 88 | for ( i = 0 ; i < maxpage ; i++, offset++ ) { |