Merge tag 'ecryptfs-3.19-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
Pull eCryptfs fixes from Tyler Hicks: "Fixes for filename decryption and encrypted view plus a cleanup - The filename decryption routines were, at times, writing a zero byte one character past the end of the filename buffer - The encrypted view feature attempted, and failed, to roll its own form of enforcing a read-only mount instead of letting the VFS enforce it" * tag 'ecryptfs-3.19-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs: eCryptfs: Remove buggy and unnecessary write in file name decode routine eCryptfs: Remove unnecessary casts when parsing packet lengths eCryptfs: Force RO mount when encrypted view is enabled
This commit is contained in:
@@ -493,6 +493,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
|
||||
{
|
||||
struct super_block *s;
|
||||
struct ecryptfs_sb_info *sbi;
|
||||
struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
|
||||
struct ecryptfs_dentry_info *root_info;
|
||||
const char *err = "Getting sb failed";
|
||||
struct inode *inode;
|
||||
@@ -511,6 +512,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
|
||||
err = "Error parsing options";
|
||||
goto out;
|
||||
}
|
||||
mount_crypt_stat = &sbi->mount_crypt_stat;
|
||||
|
||||
s = sget(fs_type, NULL, set_anon_super, flags, NULL);
|
||||
if (IS_ERR(s)) {
|
||||
@@ -557,11 +559,19 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
|
||||
|
||||
/**
|
||||
* Set the POSIX ACL flag based on whether they're enabled in the lower
|
||||
* mount. Force a read-only eCryptfs mount if the lower mount is ro.
|
||||
* Allow a ro eCryptfs mount even when the lower mount is rw.
|
||||
* mount.
|
||||
*/
|
||||
s->s_flags = flags & ~MS_POSIXACL;
|
||||
s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL);
|
||||
s->s_flags |= path.dentry->d_sb->s_flags & MS_POSIXACL;
|
||||
|
||||
/**
|
||||
* Force a read-only eCryptfs mount when:
|
||||
* 1) The lower mount is ro
|
||||
* 2) The ecryptfs_encrypted_view mount option is specified
|
||||
*/
|
||||
if (path.dentry->d_sb->s_flags & MS_RDONLY ||
|
||||
mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
|
||||
s->s_flags |= MS_RDONLY;
|
||||
|
||||
s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
|
||||
s->s_blocksize = path.dentry->d_sb->s_blocksize;
|
||||
|
Reference in New Issue
Block a user