Skip to contentSkip to conversation

Patch "ext4/fscrypto: avoid RCU lookup in d_revalidate" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message May 5, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ext4/fscrypto: avoid RCU lookup in d_revalidate

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ext4-fscrypto-avoid-rcu-lookup-in-d_revalidate.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 03a8bb0e53d9562276045bdfcf2b5de2e4cff5a1 Mon Sep 17 00:00:00 2001

From: Jaegeuk Kim <[email protected]>
Date: Tue, 12 Apr 2016 16:05:36 -0700
Subject: ext4/fscrypto: avoid RCU lookup in d_revalidate

From: Jaegeuk Kim <[email protected]>

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").

---
 fs/ext4/crypto.c |    4 ++++
 1 file changed, 4 insertions(+)
fs/ext4/crypto.c +4 -0
@@ -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"
@@ -481,6 +482,9 @@ static int ext4_d_revalidate(struct dent
 	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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/ext4-fscrypto-avoid-rcu-lookup-in-d_revalidate.patch