summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-03-22 11:32:00 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-22 11:32:00 +0000
commit9d0a150ea4c6535b6e95d291aeecf2d0d6e9315c (patch)
treed3ab81424b45df6bb83979c2a30a45afa260e8b9 /fs
parent0fa013e933cdbd3854252145a138e562aff2248c (diff)
parentfd74e8d258da9f9678da6bf88a0b02b2c1b71d0c (diff)
fscrypt: fix renaming and linking special files
am: fd74e8d258 Change-Id: I899984b06cce168a62c3ca6f2df05a6c19fdfc28
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/crypto_policy.c6
-rw-r--r--fs/f2fs/crypto_policy.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/crypto_policy.c b/fs/ext4/crypto_policy.c
index 8a9feb341f31..dd561f916f0b 100644
--- a/fs/ext4/crypto_policy.c
+++ b/fs/ext4/crypto_policy.c
@@ -156,6 +156,12 @@ int ext4_is_child_context_consistent_with_parent(struct inode *parent,
WARN_ON(1); /* Should never happen */
return 0;
}
+
+ /* No restrictions on file types which are never encrypted */
+ if (!S_ISREG(child->i_mode) && !S_ISDIR(child->i_mode) &&
+ !S_ISLNK(child->i_mode))
+ return 1;
+
/* no restrictions if the parent directory is not encrypted */
if (!ext4_encrypted_inode(parent))
return 1;
diff --git a/fs/f2fs/crypto_policy.c b/fs/f2fs/crypto_policy.c
index e504f548b64e..5bbd1989d5e6 100644
--- a/fs/f2fs/crypto_policy.c
+++ b/fs/f2fs/crypto_policy.c
@@ -149,6 +149,11 @@ int f2fs_is_child_context_consistent_with_parent(struct inode *parent,
BUG_ON(1);
}
+ /* No restrictions on file types which are never encrypted */
+ if (!S_ISREG(child->i_mode) && !S_ISDIR(child->i_mode) &&
+ !S_ISLNK(child->i_mode))
+ return 1;
+
/* no restrictions if the parent directory is not encrypted */
if (!f2fs_encrypted_inode(parent))
return 1;