diff options
author | Richard Weinberger <richard@nod.at> | 2016-09-29 21:10:06 +0300 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-12-13 01:07:38 +0300 |
commit | 9270b2f4cd9d903ed638c6cb93206baf458bdf46 (patch) | |
tree | 75e84b03ed124ffd24346bad66c1a5c5153afb2c /fs/ubifs | |
parent | ac7e47a9ed1b22b1c71345fcdec35a5d2727ef2c (diff) | |
download | linux-9270b2f4cd9d903ed638c6cb93206baf458bdf46.tar.xz |
ubifs: Preload crypto context in ->lookup()
...and mark the dentry as encrypted.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/dir.c | 15 |
1 files changed, 15 insertions, 0 deletions
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); |