[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1428012659-12709-12-git-send-email-tytso@mit.edu>
Date: Thu, 2 Apr 2015 18:10:48 -0400
From: Theodore Ts'o <tytso@....edu>
To: Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc: jaegeuk@...nel.org, mhalcrow@...gle.com,
Theodore Ts'o <tytso@....edu>
Subject: [PATCH 11/22] ext4 crypto: inherit encryption policies on inode and directory create
From: Michael Halcrow <mhalcrow@...gle.com>
Change-Id: Ibeeafc70352b39d1d5b3b17158a41d8fb54ed136
Signed-off-by: Michael Halcrow <mhalcrow@...gle.com>
Signed-off-by: Theodore Ts'o <tytso@....edu>
---
fs/ext4/namei.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 12d2592..262aa1c 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -48,6 +48,8 @@
#define NAMEI_RA_BLOCKS 4
#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
+static int ext4_unlink(struct inode *dir, struct dentry *dentry);
+
static struct buffer_head *ext4_append(handle_t *handle,
struct inode *inode,
ext4_lblk_t *block)
@@ -2247,6 +2249,13 @@ retry:
err = ext4_add_nondir(handle, dentry, inode);
if (!err && IS_DIRSYNC(dir))
ext4_handle_sync(handle);
+#ifdef CONFIG_EXT4_FS_ENCRYPTION
+ if (!err && ext4_encrypted_inode(dir)) {
+ err = ext4_inherit_context(dir, inode);
+ if (err)
+ ext4_unlink(dir, dentry);
+ }
+#endif
}
if (handle)
ext4_journal_stop(handle);
@@ -2445,6 +2454,13 @@ out_clear_inode:
d_instantiate(dentry, inode);
if (IS_DIRSYNC(dir))
ext4_handle_sync(handle);
+#ifdef CONFIG_EXT4_FS_ENCRYPTION
+ if (ext4_encrypted_inode(dir)) {
+ err = ext4_inherit_context(dir, inode);
+ if (err)
+ ext4_unlink(dir, dentry);
+ }
+#endif
out_stop:
if (handle)
--
2.3.0
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists