diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-04-12 16:05:36 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-04-12 20:01:35 -0700 |
commit | 03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1 (patch) | |
tree | 558c4c5fe4471d2570a23bb16dbe85c8ee0999ed /fs/crypto/crypto.c | |
parent | b32e4482aadfd1322357f46d4ed8a990603664d9 (diff) | |
download | linux-03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1.tar.gz linux-03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1.tar.bz2 linux-03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1.zip |
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 <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>
Diffstat (limited to 'fs/crypto/crypto.c')
-rw-r--r-- | fs/crypto/crypto.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index da70520f3ab4..2fc8c43ce531 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -26,6 +26,7 @@ #include <linux/ratelimit.h> #include <linux/bio.h> #include <linux/dcache.h> +#include <linux/namei.h> #include <linux/fscrypto.h> #include <linux/ecryptfs.h> @@ -353,6 +354,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); |