Commit c8854029 authored by Jan Blunck's avatar Jan Blunck Committed by Linus Torvalds

[PATCH] ext2_readdir() return value fix

ext2_readdir() is ignoring the set error return values and always returns
0.
Signed-off-by: default avatarJan Blunck <j.blunck@tu-harburg.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 279053ca
...@@ -257,10 +257,10 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) ...@@ -257,10 +257,10 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
unsigned char *types = NULL; unsigned char *types = NULL;
int need_revalidate = (filp->f_version != inode->i_version); int need_revalidate = (filp->f_version != inode->i_version);
int ret = 0; int ret;
if (pos > inode->i_size - EXT2_DIR_REC_LEN(1)) if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
goto done; goto success;
if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE)) if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
types = ext2_filetype_table; types = ext2_filetype_table;
...@@ -300,17 +300,19 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) ...@@ -300,17 +300,19 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
le32_to_cpu(de->inode), d_type); le32_to_cpu(de->inode), d_type);
if (over) { if (over) {
ext2_put_page(page); ext2_put_page(page);
goto done; goto success;
} }
} }
} }
ext2_put_page(page); ext2_put_page(page);
} }
success:
ret = 0;
done: done:
filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset; filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
filp->f_version = inode->i_version; filp->f_version = inode->i_version;
return 0; return ret;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment