From patchwork Fri Mar 23 19:23:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10305503 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 6935F600CC for ; Fri, 23 Mar 2018 19:31:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 597542912C for ; Fri, 23 Mar 2018 19:31:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D5062912B; Fri, 23 Mar 2018 19:31:36 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 E71272912B for ; Fri, 23 Mar 2018 19:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752563AbeCWTbe (ORCPT ); Fri, 23 Mar 2018 15:31:34 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46608 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752559AbeCWTbT (ORCPT ); Fri, 23 Mar 2018 15:31:19 -0400 Received: by mail-pl0-f66.google.com with SMTP id f5-v6so8019466plj.13; Fri, 23 Mar 2018 12:31:19 -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=EWJOxZaS0Q8k4pFBP58bHrrzrKT+Pts3f4jLsBZ5tUc=; b=HtlfYxpsAVtOjrTzSF5F/rqbW3n1aDtnY1HNIv2hEPRx+PcYIF7vdF8TMF3zSv4mk3 a9PvEfShCgV+aAkXEoRfZeSlqx/1BKmIngwAtoxpejKpEXGUlb/d5on9sn+8qaeDw57b OrH3muulH5coAhWcOTFs63OPRmQvM7x6u7Ic82VB1XxlOtyEWFqCNk556fuwMDiXzIwN vsPRbYfz0bSk40upscNDY0ngKEoX7qLA2A3UWvjXxXv5NGW2HAWyoNngT7LEKiu+iCwZ 6hALVlOAJGQyAT8LAjo1oaUK2MztttN8gY7kxDII1VZu7i6OtOVg7xsXjnDNwz7yIJxS zeuA== 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=EWJOxZaS0Q8k4pFBP58bHrrzrKT+Pts3f4jLsBZ5tUc=; b=Sfnaw6NFu2GHUG2w4ELUfB9ljbcveusbS0u1xsW/Vhp+S5oIUsFMoYjiOGLWikB6bX 0PEaouoa/Eqw9hNQ99O7AknGv/RL6V+KFGadDb0vYRkSKxXLUbgCnL23eHhMVzFvap8N y7d8dkYbc4ateq2fVmrusDAVOuwGPLD3uAXaePUqTghwg8MokRGB71ml39finlPlUAC2 zrmLDlP0COLVicSzRFDPu3gWcSPpzhQnqaSWxkl6lwMLh1ZVeTcD/IzfBxMXB+8c5ddp XJIBULzF2jND7X0uCHyQzRKcuLtIsCszu28eoKMwQ0S1r272fGbFd+nljB6C/q11WlpR vP/g== X-Gm-Message-State: AElRT7HVEAPk8oYx4dMZvlydtI+6+gOkJUsywIECLjYxUKCXtGgGfhHT neEnuoXIFuSHva02S8G5E3w/ihrR X-Google-Smtp-Source: AG47ELvtndGBY5niG4eHV0WeRG/z3ka/PD3FeZqJEf7bbmm1SUS0qacyIuqgrmi1ARTrZ1HBCk+rCw== X-Received: by 2002:a17:902:7102:: with SMTP id a2-v6mr30372329pll.87.1521833478963; Fri, 23 Mar 2018 12:31:18 -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 x1sm20924545pfk.144.2018.03.23.12.31.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 12:31:18 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Jaegeuk Kim , Eric Biggers Subject: [PATCH 08/14] fscrypt: drop empty name check from fname_decrypt() Date: Fri, 23 Mar 2018 12:23:52 -0700 Message-Id: <20180323192358.95691-9-ebiggers3@gmail.com> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog In-Reply-To: <20180323192358.95691-1-ebiggers3@gmail.com> References: <20180323192358.95691-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)