From: Tom Rini Date: Mon, 23 Nov 2015 17:44:30 -0500 Subject: [U-Boot] fs: ext4: Prevent infinite loop in ext4fs_iterate_dir In-Reply-To: <1447868573-18488-1-git-send-email-fitzsim@cisco.com> References: <1447868573-18488-1-git-send-email-fitzsim@cisco.com> Message-ID: <20151123224430.GX9551@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Nov 18, 2015 at 12:42:53PM -0500, Thomas Fitzsimmons wrote: > 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 > Reviewed-by: Stefan Roese Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: