mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* there are unencrypted files in an encrypted directory in F2FS
@ 2016-09-19  4:16 xiakaixu
  0 siblings, 0 replies; only message in thread
From: xiakaixu @ 2016-09-19  4:16 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: linux-f2fs-devel, linux-kernel, liushuoran, guoweichao, Bintian

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-19  4:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19  4:16 there are unencrypted files in an encrypted directory in F2FS xiakaixu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome