From: Theodore Ts'o Date: Sun, 31 May 2015 17:35:02 +0000 (-0400) Subject: ext4 crypto: encrypt tmpfile located in encryption protected directory X-Git-Tag: omap-for-v4.3/legacy-v2-signed~151^2~38 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e709e9df64928a99d41da75910b844976a535db7;p=pandora-kernel.git ext4 crypto: encrypt tmpfile located in encryption protected directory Factor out calls to ext4_inherit_context() and move them to __ext4_new_inode(); this fixes a problem where ext4_tmpfile() wasn't calling calling ext4_inherit_context(), so the temporary file wasn't getting protected. Since the blocks for the tmpfile could end up on disk, they really should be protected if the tmpfile is created within the context of an encrypted directory. Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 7435ff2c3efb..bd8d32d5214d 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2149,6 +2149,11 @@ static inline int ext4_get_encryption_info(struct inode *inode) return 0; } +static inline struct ext4_crypt_info *ext4_encryption_info(struct inode *inode) +{ + return EXT4_I(inode)->i_crypt_info; +} + #else static inline int ext4_has_encryption_key(struct inode *inode) { @@ -2158,6 +2163,10 @@ static inline int ext4_get_encryption_info(struct inode *inode) { return 0; } +static inline struct ext4_crypt_info *ext4_encryption_info(struct inode *inode) +{ + return NULL; +} #endif Reading git-diff-tree failed