This patch fixes to add a judgement condition to verify type of the target inode before empty directory verification.
So wrong verification could be avoided for non-directory inode. Signed-off-by: Chao Yu <chao2...@samsung.com> --- fs/f2fs/crypto_policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/crypto_policy.c b/fs/f2fs/crypto_policy.c index bef254b..56b2ac0 100644 --- a/fs/f2fs/crypto_policy.c +++ b/fs/f2fs/crypto_policy.c @@ -93,7 +93,7 @@ int f2fs_process_policy(const struct f2fs_encryption_policy *policy, return -EINVAL; if (!f2fs_inode_has_encryption_context(inode)) { - if (!f2fs_empty_dir(inode)) + if (S_ISDIR(inode->i_mode) && !f2fs_empty_dir(inode)) return -ENOTEMPTY; return f2fs_create_encryption_context_from_policy(inode, policy); -- 2.3.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/