summaryrefslogtreecommitdiff
path: root/fs/ext4/crypto.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-04-23 04:02:05 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-04-23 04:02:05 -0300
commit394569928e2f17dff4ae367ac700048138e318c7 (patch)
treec789d2a2d107284e78f6c6558267b6984f518581 /fs/ext4/crypto.c
parentbdcfd44fb5b5fb8fd660e7f93f1095c507481024 (diff)
Linux-libre 4.5.2-gnupck-4.5.2-gnu
Diffstat (limited to 'fs/ext4/crypto.c')
-rw-r--r--fs/ext4/crypto.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
index 38f756248..ecb543944 100644
--- a/fs/ext4/crypto.c
+++ b/fs/ext4/crypto.c
@@ -475,13 +475,16 @@ uint32_t ext4_validate_encryption_key_size(uint32_t mode, uint32_t size)
*/
static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)
{
- struct inode *dir = d_inode(dentry->d_parent);
- struct ext4_crypt_info *ci = EXT4_I(dir)->i_crypt_info;
+ struct dentry *dir;
+ struct ext4_crypt_info *ci;
int dir_has_key, cached_with_key;
- if (!ext4_encrypted_inode(dir))
+ dir = dget_parent(dentry);
+ if (!ext4_encrypted_inode(d_inode(dir))) {
+ dput(dir);
return 0;
-
+ }
+ ci = EXT4_I(d_inode(dir))->i_crypt_info;
if (ci && ci->ci_keyring_key &&
(ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
(1 << KEY_FLAG_REVOKED) |
@@ -491,6 +494,7 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)
/* this should eventually be an flag in d_flags */
cached_with_key = dentry->d_fsdata != NULL;
dir_has_key = (ci != NULL);
+ dput(dir);
/*
* If the dentry was cached without the key, and it is a