Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1534468

[PATCH 09/24] ubifs: Preload crypto context in ->lookup()

From Richard Weinberger <richard@nod.at>
Newsgroups linux.kernel
Subject [PATCH 09/24] ubifs: Preload crypto context in ->lookup()
Date 2016-12-01 22:30 +0100
Message-ID <sJH5x-2mT-49@gated-at.bofh.it> (permalink)
References <sJH5w-2mT-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


...and mark the dentry as encrypted.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/dir.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index bd0af4e9ca0b..9976a709b875 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -218,6 +218,21 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,
 
 	dbg_gen("'%pd' in dir ino %lu", dentry, dir->i_ino);
 
+	if (ubifs_crypt_is_encrypted(dir)) {
+		err = fscrypt_get_encryption_info(dir);
+
+		/*
+		 * DCACHE_ENCRYPTED_WITH_KEY is set if the dentry is
+		 * created while the directory was encrypted and we
+		 * have access to the key.
+		 */
+		if (fscrypt_has_encryption_key(dir))
+			fscrypt_set_encrypted_dentry(dentry);
+		fscrypt_set_d_op(dentry);
+		if (err && err != -ENOKEY)
+			return ERR_PTR(err);
+	}
+
 	if (dentry->d_name.len > UBIFS_MAX_NLEN)
 		return ERR_PTR(-ENAMETOOLONG);
 
-- 
2.7.3

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 00/24] UBIFS File Encryption v2 Richard Weinberger <richard@nod.at> - 2016-12-01 22:30 +0100
  [PATCH 10/24] ubifs: Massage assert in ubifs_xattr_set() wrt. fscrypto Richard Weinberger <richard@nod.at> - 2016-12-01 22:30 +0100
  [PATCH 06/24] ubifs: Implement directory open operation Richard Weinberger <richard@nod.at> - 2016-12-01 22:30 +0100
  [PATCH 12/24] ubifs: Introduce new data node field, compr_size Richard Weinberger <richard@nod.at> - 2016-12-01 22:30 +0100
  [PATCH 09/24] ubifs: Preload crypto context in ->lookup() Richard Weinberger <richard@nod.at> - 2016-12-01 22:30 +0100

csiph-web