ext4/fscrypto: avoid RCU lookup in d_revalidate

As Al pointed, d_revalidate should return RCU lookup before using d_inode.
This was originally introduced by:
commit 34286d6662 ("fs: rcu-walk aware d_revalidate method").

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: stable <stable@vger.kernel.org>

 Conflicts:
	fs/ext4/crypto.c
This commit is contained in:
Jaegeuk Kim 2016-04-12 16:05:36 -07:00 committed by Zhao Wei Liew
parent 4f963da44b
commit 0222e52820
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <linux/ratelimit.h>
#include <linux/bio.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/fscrypto.h>
static unsigned int num_prealloc_crypto_pages = 32;
@ -352,6 +353,9 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
struct fscrypt_info *ci;
int dir_has_key, cached_with_key;
if (flags & LOOKUP_RCU)
return -ECHILD;
dir = dget_parent(dentry);
if (!d_inode(dir)->i_sb->s_cop->is_encrypted(d_inode(dir))) {
dput(dir);