aboutsummaryrefslogtreecommitdiff
path: root/lib/ext2fs/dir_iterate.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-03-14 09:30:17 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-03-14 09:30:20 -0400
commit8f22fa055bdf9dbe0dc8a5de440ed57eb706e098 (patch)
tree60683f410a4ca7f221cfe9963a4cd1d1edfe3aea /lib/ext2fs/dir_iterate.c
parent179e3bd708251048980c845d0080de1ce79ef21a (diff)
downloade2fsprogs-8f22fa055bdf9dbe0dc8a5de440ed57eb706e098.tar.gz
libext2fs: repair side effects when iterating dirents in inline dirs
In ext2fs_inline_data_dir_iterate(), we must be very careful to undo any modifications we make to the dir_context pointer passed in by the caller, because it's entirely possible that the caller will still want to do something with the ctx or something inside. Specifically, ext2fs_dblist_dir_iterate() wants to be able to free ctx->buf, and it reuses the ctx for multiple dblist entries. That means that assigning ctx->buf will cause weird crashes at the end of dir_iterate(). Since we're being careful with ctx, we might as well handle adding the INLINE_DATA flag to ctx->flags for ext2fs_process_dir_block, since the dblist caller forgets to unset the flag before reusing the ctx. This fixes some crashes and valgrind complaints in resize2fs, and is necessary for the next patch, which fixes resize2fs not to corrupt inline_data filesystems. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/ext2fs/dir_iterate.c')
-rw-r--r--lib/ext2fs/dir_iterate.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index 8cb6740a..67152cc7 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -128,7 +128,6 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
if (!block_buf)
ext2fs_free_mem(&ctx.buf);
if (retval == EXT2_ET_INLINE_DATA_CANT_ITERATE) {
- ctx.flags |= DIRENT_FLAG_INCLUDE_INLINE_DATA;
(void) ext2fs_inline_data_dir_iterate(fs, dir, &ctx);
retval = 0;
}