diff options
author | Richard Weinberger <richard@nod.at> | 2018-03-02 14:21:11 -0800 |
---|---|---|
committer | Sasha Levin <alexander.levin@microsoft.com> | 2018-03-04 10:28:35 -0500 |
commit | ed6923107e5d09dfe1e79bf8f3cdb6815994d216 (patch) | |
tree | b99f703c607473921e79ac1b117a445eed3c8aac /fs | |
parent | 6e493d18d70209a60b091f706876d54e6ea5ce2b (diff) |
ext4: require encryption feature for EXT4_IOC_SET_ENCRYPTION_POLICY
commit 9a200d075e5d05be1fcad4547a0f8aee4e2f9a04 upstream.
...otherwise an user can enable encryption for certain files even
when the filesystem is unable to support it.
Such a case would be a filesystem created by mkfs.ext4's default
settings, 1KiB block size. Ext4 supports encyption only when block size
is equal to PAGE_SIZE.
But this constraint is only checked when the encryption feature flag
is set.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/ioctl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 4196aa567784..dbe1ff511794 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -630,6 +630,9 @@ resizefs_out: struct ext4_encryption_policy policy; int err = 0; + if (!ext4_sb_has_crypto(sb)) + return -EOPNOTSUPP; + if (copy_from_user(&policy, (struct ext4_encryption_policy __user *)arg, sizeof(policy))) { |