diff options
author | Eric Biggers <ebiggers@google.com> | 2016-12-01 11:55:51 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-12-01 11:55:51 -0500 |
commit | ba679017ef0f47d31c50df731441fdd39bf4bf13 (patch) | |
tree | 179877807c40bda7a4ee18a0ad6e26e65d3ba473 /fs/ext4/ioctl.c | |
parent | 35997d1ce8b01f9f002dd080c59e22430ead6db1 (diff) |
ext4: disable pwsalt ioctl when encryption disabled by config
On a CONFIG_EXT4_FS_ENCRYPTION=n kernel, the ioctls to get and set
encryption policies were disabled but EXT4_IOC_GET_ENCRYPTION_PWSALT was
not. But there's no good reason to expose the pwsalt ioctl if the
kernel doesn't support encryption. The pwsalt ioctl was also disabled
pre-4.8 (via ext4_sb_has_crypto() previously returning 0 when encryption
was disabled by config) and seems to have been enabled by mistake when
ext4 encryption was refactored to use fs/crypto/. So let's disable it
again.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 560afe08a5ca..fcc9510a819c 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -191,6 +191,7 @@ journal_err_out: | |||
191 | return err; | 191 | return err; |
192 | } | 192 | } |
193 | 193 | ||
194 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | ||
194 | static int uuid_is_zero(__u8 u[16]) | 195 | static int uuid_is_zero(__u8 u[16]) |
195 | { | 196 | { |
196 | int i; | 197 | int i; |
@@ -200,6 +201,7 @@ static int uuid_is_zero(__u8 u[16]) | |||
200 | return 0; | 201 | return 0; |
201 | return 1; | 202 | return 1; |
202 | } | 203 | } |
204 | #endif | ||
203 | 205 | ||
204 | static int ext4_ioctl_setflags(struct inode *inode, | 206 | static int ext4_ioctl_setflags(struct inode *inode, |
205 | unsigned int flags) | 207 | unsigned int flags) |
@@ -802,6 +804,7 @@ resizefs_out: | |||
802 | #endif | 804 | #endif |
803 | } | 805 | } |
804 | case EXT4_IOC_GET_ENCRYPTION_PWSALT: { | 806 | case EXT4_IOC_GET_ENCRYPTION_PWSALT: { |
807 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | ||
805 | int err, err2; | 808 | int err, err2; |
806 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 809 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
807 | handle_t *handle; | 810 | handle_t *handle; |
@@ -836,6 +839,9 @@ resizefs_out: | |||
836 | sbi->s_es->s_encrypt_pw_salt, 16)) | 839 | sbi->s_es->s_encrypt_pw_salt, 16)) |
837 | return -EFAULT; | 840 | return -EFAULT; |
838 | return 0; | 841 | return 0; |
842 | #else | ||
843 | return -EOPNOTSUPP; | ||
844 | #endif | ||
839 | } | 845 | } |
840 | case EXT4_IOC_GET_ENCRYPTION_POLICY: { | 846 | case EXT4_IOC_GET_ENCRYPTION_POLICY: { |
841 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 847 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |