[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 2 Mar 2018 16:59:19 -0800
From: Eric Biggers <ebiggers3@...il.com>
To: linux-ext4@...r.kernel.org
Cc: Eric Biggers <ebiggers@...gle.com>
Subject: [PATCH 06/10] e2fsck: require i_size == fscrypt_symlink_data.len + 2
From: Eric Biggers <ebiggers@...gle.com>
e2fsck validates that unencrypted symlinks have their strlen() equal to
i_size. But it skips the equivalent check of i_size ==
fscrypt_symlink_data.len + 2 for encrypted symlinks. Actually, the
encrypted symlink header is redundant with i_size and shouldn't exist.
But it's there, and the kernel does in fact use the length in the header
instead of i_size -- so e2fsck should validate the header.
Thus, remove the exception for encrypted symlinks, so e2fsck will now
require i_size == fscrypt_symlink_data.len + 2. I think the exception
was only there originally because for encrypted fast symlinks we were
calculating the length using strnlen() which was wrong. But that was
fixed by the previous patch.
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
e2fsck/pass1.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index d9df28ed..6a6c5969 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -260,8 +260,7 @@ int e2fsck_pass1_check_symlink(ext2_filsys fs, ext2_ino_t ino,
return 0;
if (len != inode->i_size)
- if ((inode->i_flags & EXT4_ENCRYPT_FL) == 0)
- return 0;
+ return 0;
return 1;
}
--
2.16.2.395.g2e18187dfd-goog
Powered by blists - more mailing lists