Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 904be634 authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Mohamad Ayyash
Browse files

ext4 crypto: policies may only be set on directories



Thanks to Chao Yu <chao2.yu@samsung.com> for pointing out we were
missing this check.

Change-Id: Ic947578c72d457ae026124e328c981db0bc8c949
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@google.com>
parent 9aa70fa9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ int ext4_process_policy(const struct ext4_encryption_policy *policy,
		return -EINVAL;

	if (!ext4_inode_has_encryption_context(inode)) {
		if (!S_ISDIR(inode->i_mode))
			return -EINVAL;
		if (!ext4_empty_dir(inode))
			return -ENOTEMPTY;
		return ext4_create_encryption_context_from_policy(inode,