u-boot/fs/ext4
Thomas Fitzsimmons 54d68e9333 fs: ext4: Prevent infinite loop in ext4fs_iterate_dir
If the ext3 journal gets out of sync with what is written on disk, for
example because of an unexpected power cut, ext4fs_read_file can
return an all-zero directory entry.  In that case, ext4fs_iterate_dir
would infinite loop.

This patch detects when a directory entry's direntlen member is 0 and
returns a failure status, which breaks out of the infinite loop.  As a
result, U-Boot will not find files that may subsequently be recovered
when the journal is replayed.

This is better behaviour than hanging in an infinite loop, but as a
further improvement maybe U-Boot could interpret the ext3 journal and
actually find the unsynced entries.

Signed-off-by: Thomas Fitzsimmons <fitzsim@cisco.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2015-11-23 11:01:52 -05:00
..
crc16.c ext4fs write support 2012-08-09 23:48:02 +02:00
crc16.h ext4fs write support 2012-08-09 23:48:02 +02:00
dev.c Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header 2015-09-11 17:15:20 -04:00
ext4_common.c fs: ext4: Prevent infinite loop in ext4fs_iterate_dir 2015-11-23 11:01:52 -05:00
ext4_common.h ext4: Prepare API change for files greater than 2GB 2014-11-23 06:49:04 -05:00
ext4_journal.c fs/ext4: fix calling put_ext4 with truncated offset 2014-01-20 10:09:38 -05:00
ext4_journal.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
ext4_write.c ext4: avoid calling ext4fs_mount() twice, which leaks 2015-09-11 17:15:22 -04:00
ext4fs.c fs/ext4/ext4fs.c, fs/fs.c fs/fat/fat_write.c: Adjust 64bit math methods 2014-12-01 15:21:57 -05:00
Kconfig kconfig: add blank Kconfig files 2014-09-24 18:30:28 -04:00
Makefile fs: descend into sub directories when it is necessary 2013-11-17 14:11:34 -05:00