summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAndries E. Brouwer <andries.brouwer@cwi.nl>2004-11-03 00:04:55 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-03 00:04:55 -0800
commitd0126f8e9970779b64bfd15fcabda43c65c83dd4 (patch)
tree1a2c27a12b64cef8f338f41ab2713e9ed2368a96 /fs
parent0a266a899690d37e8fe6f60b9d50e6075d7c29b8 (diff)
[PATCH] avoid semi-infinite loop when mounting bad ext2
The routine ext2_readdir() will, when reading a directory page returns an error, try the next page, without reporting the error to user space. That is bad, and the patch below changes that. In my case the filesystem was damaged, and ext2_readdir wanted to read 60000+ pages and wrote as many error messages to syslog ("attempt to access beyond end"), not what one wants. [no doubt a similar patch is appropriate for ext3]
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index bf30cbf571ea..64ccc7c86804 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -275,7 +275,8 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
"bad page in #%lu",
inode->i_ino);
filp->f_pos += PAGE_CACHE_SIZE - offset;
- continue;
+ ret = -EIO;
+ goto done;
}
kaddr = page_address(page);
if (need_revalidate) {