From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Biggers Subject: [PATCH 07/14] fscrypt: drop max_namelen check from fname_decrypt() Date: Fri, 23 Mar 2018 12:23:51 -0700 Message-ID: <20180323192358.95691-8-ebiggers3@gmail.com> References: <20180323192358.95691-1-ebiggers3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ezSPN-00023R-0N for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Mar 2018 19:31:25 +0000 Received: from sfi-lb-mx.v20.lw.sourceforge.com ([172.30.20.201] helo=mail-pf0-f195.google.com) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1ezSPL-00DUCL-J8 for linux-f2fs-devel@lists.sourceforge.net; Fri, 23 Mar 2018 19:31:24 +0000 Received: by mail-pf0-f195.google.com with SMTP id 123so5109052pfe.0 for ; Fri, 23 Mar 2018 12:31:23 -0700 (PDT) In-Reply-To: <20180323192358.95691-1-ebiggers3@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-mtd@lists.infradead.org, Eric Biggers , linux-f2fs-devel@lists.sourceforge.net From: Eric Biggers 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 fscrypt_decrypt() has no internal limit itself. Thus, remove this unnecessary check. Signed-off-by: Eric Biggers --- fs/crypto/fname.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index 8088a606c0aa..cc9590b5f371 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -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 */ -- 2.17.0.rc0.231.g781580f067-goog ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot