Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfae7d5c authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Gerrit - the friendly Code Review server
Browse files

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 34286d66 ("fs: rcu-walk aware d_revalidate method").

Change-Id: I81999f7b4651d7dd64695c94d15561dfdcec851b
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>
Cc: stable <stable@vger.kernel.org>
Git-commit: 03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1
Git-repo: git://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git


[andreym@codeaurora.org: resolve merge conflicts,
 fs/crypto/crypto.c does not exist in current branch,
 had to omit it]
Signed-off-by: default avatarAndrey Markovytch <andreym@codeaurora.org>
parent 958e36a7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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"
@@ -487,6 +488,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);