Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636592

[PATCH 4.4 18/20] ext4/fscrypto: avoid RCU lookup in d_revalidate

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 18/20] ext4/fscrypto: avoid RCU lookup in d_revalidate
Date 2017-05-05 20:40 +0200
Message-ID <tDQj2-5qv-87@gated-at.bofh.it> (permalink)
References <tDQiZ-5qv-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jaegeuk Kim <jaegeuk@kernel.org>

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: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ext4/crypto.c |    4 ++++
 1 file changed, 4 insertions(+)

--- 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"
@@ -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);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/20] 4.4.67-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 10/20] scsi: cxlflash: Improve EEH recovery time Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 19/20] nfsd4: minor NFSv2/v3 write decoding cleanup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 12/20] netlink: Allow direct reclaim for fallback allocation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 14/20] IB/ehca: fix maybe-uninitialized warnings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 13/20] IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 17/20] ext4 crypto: use dget_parent() in ext4_d_revalidate() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 18/20] ext4/fscrypto: avoid RCU lookup in d_revalidate Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  [PATCH 4.4 03/20] ASoC: intel: Fix PM and non-atomic crash in bytcr drivers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-05 20:40 +0200
  Re: [PATCH 4.4 00/20] 4.4.67-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-05-06 04:00 +0200
    Re: [PATCH 4.4 00/20] 4.4.67-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 05:50 +0200
  Re: [PATCH 4.4 00/20] 4.4.67-stable review Guenter Roeck <linux@roeck-us.net> - 2017-05-08 00:10 +0200

csiph-web