linux/fs/ecryptfs
Tyler Hicks e3ccaa9761 eCryptfs: Initialize empty lower files when opening them
Historically, eCryptfs has only initialized lower files in the
ecryptfs_create() path. Lower file initialization is the act of writing
the cryptographic metadata from the inode's crypt_stat to the header of
the file. The ecryptfs_open() path already expects that metadata to be
in the header of the file.

A number of users have reported empty lower files in beneath their
eCryptfs mounts. Most of the causes for those empty files being left
around have been addressed, but the presence of empty files causes
problems due to the lack of proper cryptographic metadata.

To transparently solve this problem, this patch initializes empty lower
files in the ecryptfs_open() error path. If the metadata is unreadable
due to the lower inode size being 0, plaintext passthrough support is
not in use, and the metadata is stored in the header of the file (as
opposed to the user.ecryptfs extended attribute), the lower file will be
initialized.

The number of nested conditionals in ecryptfs_open() was getting out of
hand, so a helper function was created. To avoid the same nested
conditional problem, the conditional logic was reversed inside of the
helper function.

https://launchpad.net/bugs/911507

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Colin Ian King <colin.king@canonical.com>
2012-07-08 12:51:45 -05:00
..
crypto.c eCryptfs: Improve statfs reporting 2012-02-16 16:06:21 -06:00
debug.c
dentry.c eCryptfs: Handle NULL nameidata pointers 2011-02-21 14:45:57 -06:00
ecryptfs_kernel.h eCryptfs: Initialize empty lower files when opening them 2012-07-08 12:51:45 -05:00
file.c eCryptfs: Initialize empty lower files when opening them 2012-07-08 12:51:45 -05:00
inode.c eCryptfs: Initialize empty lower files when opening them 2012-07-08 12:51:45 -05:00
Kconfig eCryptfs: fix compile error 2011-08-09 13:42:46 -05:00
keystore.c eCryptfs: Improve statfs reporting 2012-02-16 16:06:21 -06:00
kthread.c eCryptfs: Properly check for O_RDONLY flag before doing privileged open 2012-07-03 16:34:09 -07:00
main.c eCryptfs: Copy up POSIX ACL and read-only flags from lower mount 2012-07-08 12:51:43 -05:00
Makefile eCryptfs: remove netlink transport 2008-10-16 11:21:39 -07:00
messaging.c eCryptfs: Make all miscdev functions use daemon ptr in file private_data 2012-07-08 12:51:44 -05:00
miscdev.c eCryptfs: Make all miscdev functions use daemon ptr in file private_data 2012-07-08 12:51:44 -05:00
mmap.c ecryptfs: remove the second argument of k[un]map_atomic() 2012-02-16 16:06:27 -06:00
read_write.c ecryptfs: remove the second argument of k[un]map_atomic() 2012-02-16 16:06:27 -06:00
super.c vfs: Rename end_writeback() to clear_inode() 2012-05-06 13:43:41 +08:00