diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-04-13 02:05:36 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-05 00:49:12 +0300 |
commit | baf12a6b246fb5a958ff16e80e3c1e7a4178c872 (patch) | |
tree | 3b89a2d7b6e55b0763bfbb96cc4c2bb2b69a8fc7 | |
parent | 3034c3231ca4db86e03c66861f7e599b14154732 (diff) | |
download | linux-baf12a6b246fb5a958ff16e80e3c1e7a4178c872.tar.xz |
ext4/fscrypto: avoid RCU lookup in d_revalidate
commit 03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/ext4/crypto.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c index ecb54394492a..25634c353191 100644 --- a/fs/ext4/crypto.c +++ b/fs/ext4/crypto.c @@ -34,6 +34,7 @@ #include <linux/random.h> #include <linux/scatterlist.h> #include <linux/spinlock_types.h> +#include <linux/namei.h> #include "ext4_extents.h" #include "xattr.h" @@ -479,6 +480,9 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags) struct ext4_crypt_info *ci; int dir_has_key, cached_with_key; + if (flags & LOOKUP_RCU) + return -ECHILD; + dir = dget_parent(dentry); if (!ext4_encrypted_inode(d_inode(dir))) { dput(dir); |