[<prev] [next>] [day] [month] [year] [list]
Message-ID: <57DF6690.9080305@huawei.com>
Date: Mon, 19 Sep 2016 12:16:16 +0800
From: xiakaixu <xiakaixu@...wei.com>
To: Jaegeuk Kim <jaegeuk@...nel.org>
CC: <linux-f2fs-devel@...ts.sourceforge.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
liushuoran <liushuoran@...wei.com>, <guoweichao@...wei.com>,
Bintian <bintian.wang@...wei.com>
Subject: there are unencrypted files in an encrypted directory in F2FS
Hi Kim,
According to the encryption design policy "all of the files or
subdirectories in an encrypted directory must be encrypted". But
the current f2fs code seems allow to there are unencrypted files
in an encrypted directory. For example, the f2fs_create() and
f2fs_mknod() functions call f2fs_new_inode() to check the child inode.
/* If the directory encrypted, then we should encrypt the inode. */
if (f2fs_encrypted_inode(dir) && f2fs_may_encrypt(inode))
f2fs_set_encrypted_inode(inode);
static inline bool f2fs_may_encrypt(struct inode *inode)
{
#ifdef CONFIG_F2FS_FS_ENCRYPTION
umode_t mode = inode->i_mode;
return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode));
#else
return 0;
#endif
}
So even if the child inode is not REG/DIR/LNK and it still can be created
successfully which is unencrypted file. Instead, maybe here we can return
-EACCESS. Not sure about it :)
--
Regards
Kaixu Xia
Powered by blists - more mailing lists