From patchwork Wed Nov 29 20:43:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10083577 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 96F5E6020B for ; Wed, 29 Nov 2017 20:44:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89AAB285D1 for ; Wed, 29 Nov 2017 20:44:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E85C29C13; Wed, 29 Nov 2017 20:44:17 +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 1657529C14 for ; Wed, 29 Nov 2017 20:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752564AbdK2UoQ (ORCPT ); Wed, 29 Nov 2017 15:44:16 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:33254 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752361AbdK2UoQ (ORCPT ); Wed, 29 Nov 2017 15:44:16 -0500 Received: by mail-io0-f194.google.com with SMTP id t196so5169376iof.0 for ; Wed, 29 Nov 2017 12:44:16 -0800 (PST) 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=doyuUEZXqaDBF0A2apY3JIJpVb2RVv6EL4NfCTnWBtE=; b=sIBUjtxMYugw62XXLwQ7BO8/+ouNF5ed01rja1JOi9BWQxEdqWo2n5aiEq9mcHjOFD i6WJ0kVsudc055gYzrHBwf9LdCW3DHfdlF2dS1sRxa7r1Jv7ufkFblTGyYcIx5Tb+nty DKgXhpkq0P2YdjxfeVOpLilQWIgKraq64edavqH36+vDnuh/b52ziHLQjxvI+68jGUWs wtsqjoIgdu+O9KKvM3pFfdup/THQxatBk69SKVHp6PXNAscf7oetVNmtYRfZ9phGAjkP BAGtnFUfeslEAf+5T3SPVcZ1rcworsVa5ibYO/wK/+1nrCzEgcOHatJYYD/KL2pjEd5W PuoA== 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=doyuUEZXqaDBF0A2apY3JIJpVb2RVv6EL4NfCTnWBtE=; b=mvQYhJtvM+f/8F42VAxKwh4JAPubTikqOI+o0Cqn6OlVCxsOL0X/jbsQA/Fa66Ve32 w2H/QdxYXDQFyHla6HV8CuV0fDhVyfz/rJ7TKwdifrPsdJJaC+wpAn3TC00QXuH5LEZB lz76+78Y2+eLbJ5tFBG1poQcg4kSte1de/J63c1U/hhy9ZLPmZLqFC6ohegrnpULsiZm CjNUwuG80MAL96UvMATgiNgmlLraBXXI55mBhTPTGqzK9JUH9D+qbxn7twdqMwTnNVJ/ 85NgqJct4WI0+HjUDA1uKObqVzcTLYqNQHmLyg8O33IEMSkAu0FUNM6G1cGP0V/UbApj 2fPg== X-Gm-Message-State: AJaThX7UE9MwwmFBbxPdAPGz0uLKyR/69+E8iLyQHvCO8XOgb4xhPmI9 nZpx513oab6KLDuNncd6Nnw= X-Google-Smtp-Source: AGs4zMaPz3ZRbdwhg1VmBrt9J7k2Td+4APU9lfOStelOkDf7/DZlpFBAP0SehrLK9K1ABE0tDliY/g== X-Received: by 10.107.44.149 with SMTP id s143mr4937787ios.110.1511988255639; Wed, 29 Nov 2017 12:44:15 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id l4sm1111112ioc.69.2017.11.29.12.44.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 12:44:15 -0800 (PST) From: Eric Biggers To: linux-mtd@lists.infradead.org, Richard Weinberger Cc: linux-fscrypt@vger.kernel.org, Artem Bityutskiy , Adrian Hunter , Eric Biggers Subject: [PATCH v2 1/5] ubifs: switch to fscrypt_file_open() Date: Wed, 29 Nov 2017 12:43:13 -0800 Message-Id: <20171129204317.91205-2-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171129204317.91205-1-ebiggers3@gmail.com> References: <20171129204317.91205-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