From patchwork Wed Sep 20 22:46:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9962807 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 1E8B160208 for ; Wed, 20 Sep 2017 22:48:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FC182924A for ; Wed, 20 Sep 2017 22:48:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 045EA29270; Wed, 20 Sep 2017 22:48:47 +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 A333F29267 for ; Wed, 20 Sep 2017 22:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752128AbdITWrp (ORCPT ); Wed, 20 Sep 2017 18:47:45 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34765 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752002AbdITWrO (ORCPT ); Wed, 20 Sep 2017 18:47:14 -0400 Received: by mail-pf0-f193.google.com with SMTP id g65so1725901pfe.1; Wed, 20 Sep 2017 15:47:14 -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=7lGsaxjTPRiIaKGalO2p30WgH1XiARWF/SPy1lY9VQs=; b=hUp0UcHJG2/gzufdG1NQER6z3EXrl5mfazleAG6KQhou1MVO4Tn9fbCIy240lKeOKl h2C4lBI++mvwNtHXyZT+m2Xi1vZiNpRu/FFjoRXQQT5qcfeQ9MOhcbKXpfEDzEHDJSxl R0w4N/RM3qORmlXVc156tVHp2ueu6g/tMWuVfws4ykPcx6qKtOCiWehNuNH4jjXlxI5r +XEeUwZh05kMGLgUNg67/XDNB2HAQdcFN2sk1XuOjGBIpaj+SPtR60kyMhhM+iu+8NFb HEkWrpgNEHsjrmPhk2nEmVc0X4QnWcYsMBAz50jbtbHqHajrJto3XgpctkCPolXaVG2E 3P5w== 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=7lGsaxjTPRiIaKGalO2p30WgH1XiARWF/SPy1lY9VQs=; b=OB6EUP8NR16V+KqzwLtto/mLXYDTsjRoCFA4AF9QJW3BcJkEhoQZkJ7IaOFGOvZm4A 7HTFLQddQLH82xV5+Y/SWsiwLFCHDl+yQIyW5NDjxR9DklY6sl1UdCkDTbF2rOHPi62P 2X6RW9cGjlrnze4xrHKASdpzaUDtqLt8aXcr55O6yr+d8WApjtmsvyS2ti9TVYIJChdk B5eAjvz91Lej8G23JX6W64BbD7V0G+rMnxlHZb54LAZ0TFqBOBwIds6M0E7i+PIldWRm OI99MAkuIVcgU2wPx2UA4ru/QXt/EUCpd90Nps36YfWlg6Je8ZInYQeEHu6N0g0s31TU snVw== X-Gm-Message-State: AHPjjUiGuZxhLOuUExOMV7Ta9sYS0DJZkoDowbRNFacS1WJyb9yfq7fZ ACGL21Z+jKtl8S5zvljsZ7Ahr7ff6X8= X-Google-Smtp-Source: AOwi7QBM7dNIUN5G63y25ZilyfGTIrhYGxc7y1+/SRWIsGNCAIXOdasvmb3jI3uM1OJG/yfD1y1TSw== X-Received: by 10.84.129.103 with SMTP id 94mr3562803plb.151.1505947633925; Wed, 20 Sep 2017 15:47:13 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81]) by smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.47.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 15:47:13 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Michael Halcrow , Eric Biggers Subject: [PATCH 21/25] ubifs: switch to fscrypt_file_open() Date: Wed, 20 Sep 2017 15:46:01 -0700 Message-Id: <20170920224605.22030-22-ebiggers3@gmail.com> X-Mailer: git-send-email 2.14.1.821.g8fa685d3b7-goog In-Reply-To: <20170920224605.22030-1-ebiggers3@gmail.com> References: <20170920224605.22030-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 Signed-off-by: Eric Biggers --- fs/ubifs/file.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index a02aa59d1e24..31dc632a52fc 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1629,35 +1629,6 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma) return 0; } -static int ubifs_file_open(struct inode *inode, struct file *filp) -{ - int ret; - struct dentry *dir; - struct ubifs_info *c = inode->i_sb->s_fs_info; - - if (ubifs_crypt_is_encrypted(inode)) { - ret = fscrypt_get_encryption_info(inode); - if (ret) - return -EACCES; - if (!fscrypt_has_encryption_key(inode)) - return -ENOKEY; - } - - dir = dget_parent(file_dentry(filp)); - if (ubifs_crypt_is_encrypted(d_inode(dir)) && - !fscrypt_has_permitted_context(d_inode(dir), inode)) { - ubifs_err(c, "Inconsistent encryption contexts: %lu/%lu", - (unsigned long) d_inode(dir)->i_ino, - (unsigned long) inode->i_ino); - dput(dir); - ubifs_ro_mode(c, -EPERM); - return -EPERM; - } - dput(dir); - - return 0; -} - static const char *ubifs_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) @@ -1746,7 +1717,7 @@ const struct file_operations ubifs_file_operations = { .unlocked_ioctl = ubifs_ioctl, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, - .open = ubifs_file_open, + .open = fscrypt_file_open, #ifdef CONFIG_COMPAT .compat_ioctl = ubifs_compat_ioctl, #endif