[PATCH 06/10] e2fsck: require i_size == fscrypt_symlink_data.len + 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eric Biggers <ebiggers@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux