diff options
-rw-r--r-- | fs/f2fs/crypto_policy.c | 3 | ||||
-rw-r--r-- | fs/f2fs/file.c | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/fs/f2fs/crypto_policy.c b/fs/f2fs/crypto_policy.c index 30b0b73..d4a96af 100644 --- a/fs/f2fs/crypto_policy.c +++ b/fs/f2fs/crypto_policy.c @@ -92,6 +92,9 @@ int f2fs_process_policy(const struct f2fs_encryption_policy *policy, if (policy->version != 0) return -EINVAL; + if (!S_ISDIR(inode->i_mode)) + return -EINVAL; + if (!f2fs_inode_has_encryption_context(inode)) { if (!f2fs_empty_dir(inode)) return -ENOTEMPTY; diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index cb0d6b6..6b4ba74 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1395,12 +1395,6 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg) sizeof(policy))) return -EFAULT; - if (f2fs_has_inline_data(inode)) { - int ret = f2fs_convert_inline_inode(inode); - if (ret) - return ret; - } - return f2fs_process_policy(&policy, inode); #else return -EOPNOTSUPP; |