From patchwork Tue May 23 00:39:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9741571 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 DB207601C2 for ; Tue, 23 May 2017 00:40:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCD8D2876B for ; Tue, 23 May 2017 00:40:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C18CB28779; Tue, 23 May 2017 00:40:06 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 667CE2876B for ; Tue, 23 May 2017 00:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935256AbdEWAkG (ORCPT ); Mon, 22 May 2017 20:40:06 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32885 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934067AbdEWAkF (ORCPT ); Mon, 22 May 2017 20:40:05 -0400 Received: by mail-pf0-f195.google.com with SMTP id f27so23440351pfe.0; Mon, 22 May 2017 17:40:05 -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=e/jD+kDIIyZYUW7LssG/O6cKRHMgDU2AYYVPzcUZxiQ=; b=L+QvqCCXLI5FKToPAb7zFU6i/ZpXrSOqtJic6CRyBcL5CNkHxlzPVQAdULJ5L/EL3m qP7WgHUuY9BQ/rlYRzqWatameZJbRgjJ+aBvByei9CA0cB2bj4hHnnhyuqNSVNp7OwDL Zkx0V7oq8QduCkJk6IZ+h4UQ7m4XewUuW5C4R2c/4vVRf1OtOUrnTxE7UBy3kgjOxhfe QXBa6NewBCY1ehUdketbrP/juk1OzTiYpDYzjU/ii/jwNDgzeg2jJc1E9tt3dejmJM/L Q/y8MdJHTWBncqPVsFouMsH9C5NpY4Ap3hGLQQiaP5rbwzMY2P7OpGYVDZEv0zymUocr XJSA== 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=e/jD+kDIIyZYUW7LssG/O6cKRHMgDU2AYYVPzcUZxiQ=; b=K/Bh2PH2gtOOt+wdvPH6WxUEWnezK5Z1eEgl/IFFOb82oo7x6V/ViaKUoeYZbIOR7b KS2hjCpW0FtHoUsqAp2ERc0VsEqjx1NmmH23zonVzKLlqxzZVvyGR/8me/lfXxTns9yP BBZ6Jcx2sRNtjojzCyp4rQvlsldDyul6QKzlXjrYmDZVKgAM+mAsSD1caz0TmbhsZe2t 48Wvc0FXOvLWCJDGSoNuGyWUczxLVi/4kkepr3QYQ8HWmTEgaU7cwXMa1ZQJB2O7sXOF ret8ETplKvGXSjQR+pj9Z/0c+/5XJpvoSLe9Q/7WF0NG20/xHEAyO8EndBhlCQFiGIj3 9Frg== X-Gm-Message-State: AODbwcDqvatlUcP6BGMaSdbi2gGMx/+vnG6c/dHqwkC4PxA0EisLllP+ pO8pmnzq2Vb2qsuVNHA= X-Received: by 10.84.232.71 with SMTP id f7mr32978793pln.168.1495500004585; Mon, 22 May 2017 17:40:04 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.39]) by smtp.gmail.com with ESMTPSA id l85sm18172985pfj.130.2017.05.22.17.40.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 17:40:04 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: Theodore Ts'o , Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers Subject: [PATCH 2/4] f2fs: don't bother checking for encryption key in ->mmap() Date: Mon, 22 May 2017 17:39:43 -0700 Message-Id: <20170523003945.14279-3-ebiggers3@gmail.com> X-Mailer: git-send-email 2.13.0.303.g4ebf302169-goog In-Reply-To: <20170523003945.14279-1-ebiggers3@gmail.com> References: <20170523003945.14279-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 Since only an open file can be mmap'ed, and we only allow open()ing an encrypted file when its key is available, there is no need to check for the key again before permitting each mmap(). This f2fs copy of this code was also broken in that it wouldn't actually have failed if the key was in fact unavailable. Signed-off-by: Eric Biggers Acked-by: Chao Yu --- fs/f2fs/file.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 61af721329fa..ff4db3efc0ac 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -415,14 +415,6 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma) struct inode *inode = file_inode(file); int err; - if (f2fs_encrypted_inode(inode)) { - err = fscrypt_get_encryption_info(inode); - if (err) - return 0; - if (!f2fs_encrypted_inode(inode)) - return -ENOKEY; - } - /* we don't need to use inline_data strictly */ err = f2fs_convert_inline_inode(inode); if (err)