From patchwork Thu Mar 14 17:15:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 10853339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E39C14DE for ; Thu, 14 Mar 2019 17:23:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F1D22A534 for ; Thu, 14 Mar 2019 17:23:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62B432A54E; Thu, 14 Mar 2019 17:23:15 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 758B22A534 for ; Thu, 14 Mar 2019 17:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727078AbfCNRXO (ORCPT ); Thu, 14 Mar 2019 13:23:14 -0400 Received: from lilium.sigma-star.at ([109.75.188.150]:53164 "EHLO lilium.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfCNRXN (ORCPT ); Thu, 14 Mar 2019 13:23:13 -0400 X-Greylist: delayed 418 seconds by postgrey-1.27 at vger.kernel.org; Thu, 14 Mar 2019 13:23:12 EDT Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id A4EC818013763; Thu, 14 Mar 2019 18:16:20 +0100 (CET) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: linux-fscrypt@vger.kernel.org, jaegeuk@kernel.org, tytso@mit.edu, linux-unionfs@vger.kernel.org, miklos@szeredi.hu, amir73il@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, paullawrence@google.com, Richard Weinberger Subject: [PATCH 1/4] fscrypt: Implement FS_CFLG_OWN_D_OPS Date: Thu, 14 Mar 2019 18:15:56 +0100 Message-Id: <20190314171559.27584-2-richard@nod.at> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190314171559.27584-1-richard@nod.at> References: <20190314171559.27584-1-richard@nod.at> MIME-Version: 1.0 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 If a filesystem sets FS_CFLG_OWN_D_OPS it manages dentry operations itself and fscrypt is not allowed to set them. Signed-off-by: Richard Weinberger --- fs/crypto/hooks.c | 4 +++- include/linux/fscrypt.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c index 56debb1fcf5e..3ec925405fbe 100644 --- a/fs/crypto/hooks.c +++ b/fs/crypto/hooks.c @@ -107,7 +107,9 @@ int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry) spin_unlock(&dentry->d_lock); } - d_set_d_op(dentry, &fscrypt_d_ops); + if ((dir->i_sb->s_cop->flags & FS_CFLG_OWN_D_OPS) == 0) + d_set_d_op(dentry, &fscrypt_d_ops); + return 0; } EXPORT_SYMBOL_GPL(__fscrypt_prepare_lookup); diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index e5194fc3983e..7139a110ac4f 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -48,6 +48,7 @@ struct fscrypt_name { * fscrypt superblock flags */ #define FS_CFLG_OWN_PAGES (1U << 1) +#define FS_CFLG_OWN_D_OPS (1U << 2) /* * crypto operations for filesystems