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: 842751 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LsdgwYE4"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sIBUjtxM"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ynCG02y2zz9s72 for ; Thu, 30 Nov 2017 07:44:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1H2ZNUSSQ6JYUgTyrqBOgepLXym3FdJ6FZo2iKnWZBM=; b=LsdgwYE4vi74bLTk8pH3ef6It+ /Hcr6UxmQh0RwdzfqwLgSJNcIl8fDpwcoLHbaZk8tREVXkcReSScWSPgjaB9mgxrhAGusb9nYR3xO VGeI5kblkkX4TBpS9yFmfX8Bb2RP08Dd1bRu/DAqA4SiwQ2oTKe5fUJMPq/2ovQ9nO69JxYTFa7gd t4W8a/PpmMzEHb2DXjFcSxNkOH9meau+na982VSv3Q/x5TM69GFfzKSAPJ5LXiIqqThqTFQJCygiW vC+6HjqE3zl0CxiTMLXYxp/Gq/JMe+kYLtqv5WQyDMWVnTZ/s1FWaRz8N8GSeIrUCw6lVwci4lpqK djKn4scg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eK9Dt-00038K-CR; Wed, 29 Nov 2017 20:44:49 +0000 Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eK9De-0002v7-5t for linux-mtd@lists.infradead.org; Wed, 29 Nov 2017 20:44:35 +0000 Received: by mail-io0-x243.google.com with SMTP id d21so5126407ioe.7 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=TpLJPpbbefhpk/Qq+56rDZY0+wpezScvGU4vE3rUbKtel2tjEj9NypPnTSkctlg06A fLC0pBbxnxNxo54CimU5oU7c6aU5zgDouI84m/zYCkB8eBnAuGc4t26qZA8K03RNmXZ9 XxjoqFGeY/3qUEhNjtRHyELryVt+fUF0sH8se3OdDfy15LNuc4nQ5/VxwJAOkrHBmX9d RzQpgGepkuM1VA/riqwkUM4KH9DwD5oichxhvwQ4I4H4ZMIUpAfIVlO7Y4RwsaSAofkz beOvXW1rhyhgHk52ydYQeqwOxssRy3cQU7kseBooMt5REXbhyYBRdAXKNOLgko4qrkfV RbAg== X-Gm-Message-State: AJaThX4BQu/8q6igKD0F8T4WK0wtYz9tEUWOJ+We/PsYQJpc4Nr7ZPCj 6cCdCvnd4U8TZllhkHJiChAWV54YvIQ= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_124434_266168_9AC77B67 X-CRM114-Status: GOOD ( 10.70 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:4001:c06:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (ebiggers3[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ebiggers3[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fscrypt@vger.kernel.org, Eric Biggers , Adrian Hunter , Artem Bityutskiy MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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