summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/crypto_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/crypto_policy.c')
-rw-r--r--fs/f2fs/crypto_policy.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/crypto_policy.c b/fs/f2fs/crypto_policy.c
index 30b0b73d4200..d4a96af513c2 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;