Commit b9ffce9a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ecryptfs-4.3-rc1-stale-dcache' of...

Merge tag 'ecryptfs-4.3-rc1-stale-dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs

Pull ecryptfs fixes from Tyler Hicks:
 "Invalidate stale eCryptfs dcache entries caused by unlinked lower
  inodes"

* tag 'ecryptfs-4.3-rc1-stale-dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
  eCryptfs: Delete a check before the function call "key_put"
  eCryptfs: Invalidate dcache entries when lower i_nlink is zero
parents 0c8e2f2c 0dad87fc
...@@ -258,8 +258,7 @@ void ecryptfs_destroy_mount_crypt_stat( ...@@ -258,8 +258,7 @@ void ecryptfs_destroy_mount_crypt_stat(
&mount_crypt_stat->global_auth_tok_list, &mount_crypt_stat->global_auth_tok_list,
mount_crypt_stat_list) { mount_crypt_stat_list) {
list_del(&auth_tok->mount_crypt_stat_list); list_del(&auth_tok->mount_crypt_stat_list);
if (auth_tok->global_auth_tok_key if (!(auth_tok->flags & ECRYPTFS_AUTH_TOK_INVALID))
&& !(auth_tok->flags & ECRYPTFS_AUTH_TOK_INVALID))
key_put(auth_tok->global_auth_tok_key); key_put(auth_tok->global_auth_tok_key);
kmem_cache_free(ecryptfs_global_auth_tok_cache, auth_tok); kmem_cache_free(ecryptfs_global_auth_tok_cache, auth_tok);
} }
......
...@@ -45,20 +45,20 @@ ...@@ -45,20 +45,20 @@
static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
{ {
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
int rc; int rc = 1;
if (!(lower_dentry->d_flags & DCACHE_OP_REVALIDATE))
return 1;
if (flags & LOOKUP_RCU) if (flags & LOOKUP_RCU)
return -ECHILD; return -ECHILD;
rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); if (lower_dentry->d_flags & DCACHE_OP_REVALIDATE)
rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
if (d_really_is_positive(dentry)) { if (d_really_is_positive(dentry)) {
struct inode *lower_inode = struct inode *inode = d_inode(dentry);
ecryptfs_inode_to_lower(d_inode(dentry));
fsstack_copy_attr_all(d_inode(dentry), lower_inode); fsstack_copy_attr_all(inode, ecryptfs_inode_to_lower(inode));
if (!inode->i_nlink)
return 0;
} }
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment