Patch "ext4 crypto: use dget_parent() in ext4_d_revalidate()" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ext4 crypto: use dget_parent() in ext4_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-crypto-use-dget_parent-in-ext4_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
3d43bcfef5f0548845a425365011c499875491b0Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <[email protected]>
Date: Sat, 26 Mar 2016 16:15:42 -0400
Subject: ext4 crypto: use dget_parent() in ext4_d_revalidate()
From: Theodore Ts'o <[email protected]>
commit 3d43bcfef5f0548845a425365011c499875491b0 upstream.
This avoids potential problems caused by a race where the inode gets renamed out from its parent directory and the parent directory is deleted while ext4_d_revalidate() is running.
--- fs/ext4/crypto.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/ext4/crypto.c +8 -3
@@ -477,16 +477,21 @@ uint32_t ext4_validate_encryption_key_si*/ static int ext4_d_revalidate (struct dentry *dentry,unsigned int flags) { -struct inode *dir =d_inode (dentry->d_parent); -struct ext4_crypt_info *ci =EXT4_I (dir)->i_crypt_info; +struct dentry *dir; +struct ext4_crypt_info *ci;int dir_has_key, cached_with_key; -if (!ext4_encrypted_inode (dir)) + dir =dget_parent (dentry); +if (!ext4_encrypted_inode (d_inode (dir))) { +dput (dir);return 0 ; + } + ci =EXT4_I (d_inode (dir))->i_crypt_info;/* this should eventually be an flag in d_flags */ cached_with_key = dentry->d_fsdata !=NULL ; dir_has_key = (ci !=NULL ); +dput (dir);/* * If the dentry was cached without the key, and it is a
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/ext4-fscrypto-avoid-rcu-lookup-in-d_revalidate.patch queue-4.4/ext4-crypto-revalidate-dentry-after-adding-or-removing-the-key.patch queue-4.4/ext4-crypto-use-dget_parent-in-ext4_d_revalidate.patch queue-4.4/ext4-require-encryption-feature-for-ext4_ioc_set_encryption_policy.patch