Commit 16fb859f authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Greg Kroah-Hartman

ext4/fscrypto: avoid RCU lookup in d_revalidate

commit 03a8bb0e upstream.

As Al pointed, d_revalidate should return RCU lookup before using d_inode.
This was originally introduced by:
commit 34286d66 ("fs: rcu-walk aware d_revalidate method").
Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41948f88
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/random.h> #include <linux/random.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/spinlock_types.h> #include <linux/spinlock_types.h>
#include <linux/namei.h>
#include "ext4_extents.h" #include "ext4_extents.h"
#include "xattr.h" #include "xattr.h"
...@@ -481,6 +482,9 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -481,6 +482,9 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)
struct ext4_crypt_info *ci; struct ext4_crypt_info *ci;
int dir_has_key, cached_with_key; int dir_has_key, cached_with_key;
if (flags & LOOKUP_RCU)
return -ECHILD;
dir = dget_parent(dentry); dir = dget_parent(dentry);
if (!ext4_encrypted_inode(d_inode(dir))) { if (!ext4_encrypted_inode(d_inode(dir))) {
dput(dir); dput(dir);
......
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