1 ext4: require encryption feature for EXT4_IOC_SET_ENCRYPTION_POLICY
3 From: Richard Weinberger <richard@nod.at>
5 ...otherwise an user can enable encryption for certain files even
6 when the filesystem is unable to support it.
7 Such a case would be a filesystem created by mkfs.ext4's default
8 settings, 1KiB block size. Ext4 supports encyption only when block size
10 But this constraint is only checked when the encryption feature flag
13 Signed-off-by: Richard Weinberger <richard@nod.at>
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
16 fs/ext4/ioctl.c | 3 +++
17 1 file changed, 3 insertions(+)
19 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
20 index 1bb7df5..9e9a73e 100644
23 @@ -772,6 +772,9 @@ resizefs_out:
24 #ifdef CONFIG_EXT4_FS_ENCRYPTION
25 struct fscrypt_policy policy;
27 + if (!ext4_has_feature_encrypt(sb))
30 if (copy_from_user(&policy,
31 (struct fscrypt_policy __user *)arg,
37 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
38 the body of a message to majordomo@vger.kernel.org
39 More majordomo info at http://vger.kernel.org/majordomo-info.html