From 0222e52820d37f567ee2613d013dd3ad95c9cb6e Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 12 Apr 2016 16:05:36 -0700 Subject: [PATCH] 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 34286d666230 ("fs: rcu-walk aware d_revalidate method"). Reported-by: Al Viro Signed-off-by: Jaegeuk Kim Cc: Theodore Ts'o Cc: stable Conflicts: fs/ext4/crypto.c --- fs/crypto/crypto.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index 1447ea0538e4..a340a6f6f531 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -28,6 +28,7 @@ #include #include #include +#include #include 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);