mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									a6b91919e0
								
							
						
					
					
						commit
						08ca0db8aa
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -72,6 +72,17 @@ static int zisofs_readpage(struct file *file, struct page *page)
 | 
			
		|||
	offset = index & ~zisofs_block_page_mask;
 | 
			
		||||
	blockindex = offset >> zisofs_block_page_shift;
 | 
			
		||||
	maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * If this page is wholly outside i_size we just return zero;
 | 
			
		||||
	 * do_generic_file_read() will handle this for us
 | 
			
		||||
	 */
 | 
			
		||||
	if (page->index >= maxpage) {
 | 
			
		||||
		SetPageUptodate(page);
 | 
			
		||||
		unlock_page(page);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	maxpage = min(zisofs_block_pages, maxpage-offset);
 | 
			
		||||
 | 
			
		||||
	for ( i = 0 ; i < maxpage ; i++, offset++ ) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue