Add stable@vger.kernel.org annotations
[ext4-patch-queue.git] / require-encryption-feature-for-EXT4_IOC_SET_ENCRYPTION_POLICY
blobf58e0f684fc1cd4cf66a4aac0daedac6fe31f8b5
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
9 is equal to PAGE_SIZE.
10 But this constraint is only checked when the encryption feature flag
11 is set.
13 Signed-off-by: Richard Weinberger <richard@nod.at>
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 ---
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
21 --- a/fs/ext4/ioctl.c
22 +++ b/fs/ext4/ioctl.c
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))
28 +                       return -EOPNOTSUPP;
30                 if (copy_from_user(&policy,
31                                    (struct fscrypt_policy __user *)arg,
32                                    sizeof(policy)))
33 -- 
34 2.7.3
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