From 1487abde26ae07c507d95f4a59021b2f647e64f1 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 7 Feb 2016 19:35:05 -0500 Subject: ext4 crypto: revalidate dentry after adding or removing the key Add a validation check for dentries for encrypted directory to make sure we're not caching stale data after a key has been added or removed. Also check to make sure that status of the encryption key is updated when readdir(2) is executed. Signed-off-by: Theodore Ts'o Signed-off-by: Theodore Ts'o Change-Id: Ic7a90d79d9447272fc512ae2abbd299523de02b8 --- include/linux/dcache.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/linux/dcache.h') diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f2c042f1c..15b03546d 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -420,6 +420,23 @@ static inline bool d_is_su(const struct dentry *dentry) !memcmp(dentry->d_name.name, "su", 2); } +/** + * d_inode - Get the actual inode of this dentry + * @dentry: The dentry to query + * + * This is the helper normal filesystems should use to get at their own inodes + * in their own dentries and ignore the layering superimposed upon them. + */ +static inline struct inode *d_inode(const struct dentry *dentry) +{ + return dentry->d_inode; +} + +static inline bool d_is_negative(const struct dentry *dentry) +{ + return (dentry->d_inode == NULL); +} + extern int sysctl_vfs_cache_pressure; #endif /* __LINUX_DCACHE_H */ -- cgit v1.2.3