From patchwork Mon Apr 30 22:51:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10373021 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18D886032A for ; Mon, 30 Apr 2018 22:56:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07A551FF83 for ; Mon, 30 Apr 2018 22:56:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F033E20243; Mon, 30 Apr 2018 22:56:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93EB223B23 for ; Mon, 30 Apr 2018 22:56:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755415AbeD3W4t (ORCPT ); Mon, 30 Apr 2018 18:56:49 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38979 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755390AbeD3W4r (ORCPT ); Mon, 30 Apr 2018 18:56:47 -0400 Received: by mail-pf0-f195.google.com with SMTP id z9so7866568pfe.6; Mon, 30 Apr 2018 15:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sqPrY0sqsIid7e09Q3AsQplZFzNhnxQtv38fdTmgmT4=; b=HoretyeGPJhIQBYsrcb+pR3lr1IAzCO1X6Axo4OiOompaeADIlun6mZWRT8uuvmz2J xFM4Yi06IcbBd5sWJrNuf89SPiYFXEgOAEdFTchaKW9HBEYfsucveKrhTwyR8Gco9vpm uui8YoUFWoUs7vw98lDDYD3P91p18D0iKmBVcspZpBBFX+h/egBe9q6Ruau3sRmgrBRq lkNUEIMmhMBTY57PM3ubq8XAv//ODSbZiuflIdw/bhiz9FnL++/qoVnTHEhW6kmyiUU8 +EWGKrO3jWr2WC00F00PMO61PHiDPBDAReumUyI2hwUhvzZlq9DdSyRTu9ZjJKXobXwI Isqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sqPrY0sqsIid7e09Q3AsQplZFzNhnxQtv38fdTmgmT4=; b=pTuQMqeo5pxD2irZzMIJnl//CSI3rwEKyCSjvukGS5wUDtJOOS+riz+RKel4s3dPJP kYbuJMB6iHAKmf30TRM69JEnikxeqAky/I1tQbvqJpfiWVqVx52zlMZ8b6rbSYYc13Ta CVKeC8/CxTDPX6RMSsOb7cVyOT9unqhBwoKrAmYZEmaxwr5gB4LmfGqRxg+09T11+LfS 9KV3gWzjpQLDNDddnU87T1aA28JSBMT6ixKLSfVGV2FmDydo/N0YImpMdRTwB3RIEJE3 xrIaAbXz8CcJQm0CpTr78MEv7m9XssRCooQsKepDf/F3+BRsZsP0NaD8eoxzosxAgq3D IIFA== X-Gm-Message-State: ALQs6tBZB+G3uFxblUK8afL0x9qpt048acgNlHHHJ21kZB/roth0w3Lo NFE5YkLa7jY+DByzjzUkBy/wZ8Ho X-Google-Smtp-Source: AB8JxZrKdMhCClqFFLbhheRQxkK16Ml9D91QYYVtHcrseGEVRMSa8OWDLWN2cGFtwxJ9hTb5VEekpA== X-Received: by 2002:a63:9711:: with SMTP id n17-v6mr11060029pge.171.1525129007071; Mon, 30 Apr 2018 15:56:47 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id b15sm12969305pfi.111.2018.04.30.15.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 15:56:46 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers Subject: [PATCH 09/15] fscrypt: drop empty name check from fname_decrypt() Date: Mon, 30 Apr 2018 15:51:43 -0700 Message-Id: <20180430225149.183514-10-ebiggers3@gmail.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180430225149.183514-1-ebiggers3@gmail.com> References: <20180430225149.183514-1-ebiggers3@gmail.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers fname_decrypt() is validating that the encrypted filename is nonempty. However, earlier a stronger precondition was already enforced: the encrypted filename must be at least 16 (FS_CRYPTO_BLOCK_SIZE) bytes. Drop the redundant check for an empty filename. Signed-off-by: Eric Biggers --- fs/crypto/fname.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index cc9590b5f371..c4eb3a235ae4 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -97,9 +97,6 @@ static int fname_decrypt(struct inode *inode, int res = 0; char iv[FS_CRYPTO_BLOCK_SIZE]; - if (iname->len <= 0) - return -EIO; - /* Allocate request */ req = skcipher_request_alloc(tfm, GFP_NOFS); if (!req)