e2fsck: require i_size == fscrypt_symlink_data.len + 2

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@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 file changed