fscrypt: drop max_namelen check from fname_decrypt()
authorEric Biggers <ebiggers@google.com>
Mon, 30 Apr 2018 22:51:42 +0000 (15:51 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 20 May 2018 20:21:02 +0000 (16:21 -0400)
fname_decrypt() returns an error if the input filename is longer than
the inode's ->max_namelen() as given by the filesystem.  But, this
doesn't actually make sense because the filesystem provided the input
filename in the first place, where it was subject to the filesystem's
limits.  And fname_decrypt() has no internal limit itself.

Thus, remove this unnecessary check.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/crypto/fname.c

index 8088a606c0aa260f0df17ca59a29e82b4838bf10..cc9590b5f371a5b35c0311885e51136419b8c345 100644 (file)
@@ -93,14 +93,11 @@ static int fname_decrypt(struct inode *inode,
        struct skcipher_request *req = NULL;
        DECLARE_CRYPTO_WAIT(wait);
        struct scatterlist src_sg, dst_sg;
-       struct fscrypt_info *ci = inode->i_crypt_info;
-       struct crypto_skcipher *tfm = ci->ci_ctfm;
+       struct crypto_skcipher *tfm = inode->i_crypt_info->ci_ctfm;
        int res = 0;
        char iv[FS_CRYPTO_BLOCK_SIZE];
-       unsigned lim;
 
-       lim = inode->i_sb->s_cop->max_namelen(inode);
-       if (iname->len <= 0 || iname->len > lim)
+       if (iname->len <= 0)
                return -EIO;
 
        /* Allocate request */