diff mbox

[20/21] e2fsck: don't set prev after processing '..' on an inline dir

Message ID 20140805010709.2611.18449.stgit@birch.djwong.org
State Accepted, archived
Headers show

Commit Message

Darrick Wong Aug. 5, 2014, 1:07 a.m. UTC
In an inline directory, the '..' entry is compacted down to just the
inode number; there is no full '..' entry.  Therefore, it makes no
sense to assign 'prev' to the fake dotdot entry we put on the stack,
as this could confuse a salvage_directory call on a corrupted next
entry into modifying stack contents (the fake dotdot entry).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 e2fsck/pass2.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Theodore Ts'o Aug. 10, 2014, 10:50 p.m. UTC | #1
On Mon, Aug 04, 2014 at 06:07:09PM -0700, Darrick J. Wong wrote:
> In an inline directory, the '..' entry is compacted down to just the
> inode number; there is no full '..' entry.  Therefore, it makes no
> sense to assign 'prev' to the fake dotdot entry we put on the stack,
> as this could confuse a salvage_directory call on a corrupted next
> entry into modifying stack contents (the fake dotdot entry).
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Applied, thanks.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index ed2c4d7..fb98af5 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -1330,8 +1330,19 @@  skip_checksum:
 		if (!inline_data_size || dot_state > 1) {
 			offset += rec_len;
 		} else {
-			if (dot_state == 1)
+			if (dot_state == 1) {
 				offset = 4;
+				/*
+				 * If we get here, we're checking an inline
+				 * directory and we've just checked a (fake)
+				 * dotdot entry that we created on the stack.
+				 * Therefore set 'prev' to NULL so that if we
+				 * call salvage_directory on the next entry,
+				 * it won't try to absorb the next entry into
+				 * the on-stack dotdot entry.
+				 */
+				prev = NULL;
+			}
 		}
 		dot_state++;
 	} while (is_last_entry(fs, inline_data_size, offset, de_csum_size));