From patchwork Tue May 23 00:39:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9741573 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 A1F9F601C2 for ; Tue, 23 May 2017 00:40:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 947DA2876B for ; Tue, 23 May 2017 00:40:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 894B928779; Tue, 23 May 2017 00:40:08 +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 4823F2876B for ; Tue, 23 May 2017 00:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935273AbdEWAkI (ORCPT ); Mon, 22 May 2017 20:40:08 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36561 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934067AbdEWAkH (ORCPT ); Mon, 22 May 2017 20:40:07 -0400 Received: by mail-pf0-f194.google.com with SMTP id n23so23416052pfb.3; Mon, 22 May 2017 17:40:07 -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=soRGN3gEKJIaYk8hJHMv18ryHzPDM2V3T6bWa6b9gX4=; b=UHN6jFSRHR8fst1My7KQSnZ6Q1CvzTasrB0STjDohV72DCstGNB6c/gX1/iGYaBIrz cJ7wWpb/DBXKbzzKsRiBZofTwMB5wtkY6xVtVyLMYJRU3kGtIfEMf/IRO7CvkymjNB4A Y6r2KK55+90IZLeYEdQumWHeBSE1xSeE/C6kXWhFYPO2A4ErlIjCNh+HUfjwUK8QWJyA jaT1csy1Mb+9F0aoqat1hM2TwCF23SF+BCafDexPbFOAHvb3+joZWWqYNsjfLCwRPftT s/Isft6v29gqj+agC+RNBNo9PtqGtCyx0wfdXFE8o6I9+r10CCghFTIXOnnPVC4VxDD2 f4mQ== 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=soRGN3gEKJIaYk8hJHMv18ryHzPDM2V3T6bWa6b9gX4=; b=mm2+4p81XGciLx6x0Mwvo5isrveUZlJ2vQj0E0on67eTYtNdsk9FJYYggM4JzWIApK /8skGotpyuMiex5luWA+7RCekxL4KEFJcrCFnnoxTJcEvDEeDXvZtwKWQy9NV5MQvkAo 5D30uQjo88dORfR47y5zQyqBLnYKPdRdftHOSshfGjOBJ7XJ7QVq2GVhxuimvvGLmVtI gVLP+h+4R7u5Bu1YkCHpPOiV7oWhbuyI+e/6pG1WBYWd9nG5VHUCxiz+F3G0xNdpboD3 V24jI7jiM9OnVZiJCbo6DQLmOmGYs6PBgTMuiewjPb0oOiPoLZBJ43q4PLiJRc9xgwrJ um8g== X-Gm-Message-State: AODbwcD9AcFp3gInU2SGJH6Ev7SLSumfTVG8GoEo0pONtTitdmjWQrvV tnXxQuslVgt/1A== X-Received: by 10.84.176.3 with SMTP id u3mr16067040plb.119.1495500006629; Mon, 22 May 2017 17:40:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 17:40:06 -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 3/4] ubifs: don't bother checking for encryption key in ->mmap() Date: Mon, 22 May 2017 17:39:44 -0700 Message-Id: <20170523003945.14279-4-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(). Signed-off-by: Eric Biggers Acked-by: Richard Weinberger --- fs/ubifs/file.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 2cda3d67e2d0..7dc58bda279b 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1607,15 +1607,6 @@ static const struct vm_operations_struct ubifs_file_vm_ops = { static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma) { int err; - struct inode *inode = file->f_mapping->host; - - if (ubifs_crypt_is_encrypted(inode)) { - err = fscrypt_get_encryption_info(inode); - if (err) - return -EACCES; - if (!fscrypt_has_encryption_key(inode)) - return -ENOKEY; - } err = generic_file_mmap(file, vma); if (err)