mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* linux-next: manual merge of the ecryptfs tree with Linus' tree
@ 2011-01-15  0:15 Stephen Rothwell
  2011-01-17 23:11 ` Tyler Hicks
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2011-01-15  0:15 UTC (permalink / raw)
  To: Tyler Hicks; +Cc: linux-next, linux-kernel, Al Viro, Roberto Sassu

Hi Tyler,

Today's linux-next merge of the ecryptfs tree got a conflict in
fs/ecryptfs/main.c between commit
66cb76666d69502fe982990b2cff5b6d607fd3b1 ("sanitize ecryptfs ->mount()")
from Linus' tree and commit c65b788ce32e9cd1c7d221551275774f1aa83084
("ecryptfs: missing initialization of the superblock 'magic' field") from
the ecryptfs tree.

I fixed it up (I think - see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/ecryptfs/main.c
index d3b28ab,70009a7..0000000
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@@ -546,54 -587,34 +546,55 @@@ static struct dentry *ecryptfs_mount(st
  	/* ->kill_sb() will take care of sbi after that point */
  	sbi = NULL;
  	s->s_op = &ecryptfs_sops;
 +	s->s_d_op = &ecryptfs_dops;
  
 -	rc = -ENOMEM;
 -	s->s_root = d_alloc(NULL, &(const struct qstr) {
 -			     .hash = 0,.name = "/",.len = 1});
 +	err = "Reading sb failed";
 +	rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
 +	if (rc) {
 +		ecryptfs_printk(KERN_WARNING, "kern_path() failed\n");
 +		goto out1;
 +	}
 +	if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) {
 +		rc = -EINVAL;
 +		printk(KERN_ERR "Mount on filesystem of type "
 +			"eCryptfs explicitly disallowed due to "
 +			"known incompatibilities\n");
 +		goto out_free;
 +	}
 +	ecryptfs_set_superblock_lower(s, path.dentry->d_sb);
 +	s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
 +	s->s_blocksize = path.dentry->d_sb->s_blocksize;
++	s->s_magic = ECRYPTFS_SUPER_MAGIC;
 +
 +	inode = ecryptfs_get_inode(path.dentry->d_inode, s);
 +	rc = PTR_ERR(inode);
 +	if (IS_ERR(inode))
 +		goto out_free;
 +
 +	s->s_root = d_alloc_root(inode);
  	if (!s->s_root) {
 -		deactivate_locked_super(s);
 -		goto out;
 +		iput(inode);
 +		rc = -ENOMEM;
 +		goto out_free;
  	}
 -	s->s_root->d_op = &ecryptfs_dops;
 -	s->s_root->d_sb = s;
 -	s->s_root->d_parent = s->s_root;
  
 +	rc = -ENOMEM;
  	root_info = kmem_cache_zalloc(ecryptfs_dentry_info_cache, GFP_KERNEL);
 -	if (!root_info) {
 -		deactivate_locked_super(s);
 -		goto out;
 -	}
 +	if (!root_info)
 +		goto out_free;
 +
  	/* ->kill_sb() will take care of root_info */
  	ecryptfs_set_dentry_private(s->s_root, root_info);
 +	ecryptfs_set_dentry_lower(s->s_root, path.dentry);
 +	ecryptfs_set_dentry_lower_mnt(s->s_root, path.mnt);
 +
  	s->s_flags |= MS_ACTIVE;
 -	rc = ecryptfs_read_super(s, dev_name);
 -	if (rc) {
 -		deactivate_locked_super(s);
 -		err = "Reading sb failed";
 -		goto out;
 -	}
  	return dget(s->s_root);
  
 +out_free:
 +	path_put(&path);
 +out1:
 +	deactivate_locked_super(s);
  out:
  	if (sbi) {
  		ecryptfs_destroy_mount_crypt_stat(&sbi->mount_crypt_stat);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-17 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15  0:15 linux-next: manual merge of the ecryptfs tree with Linus' tree Stephen Rothwell
2011-01-17 23:11 ` Tyler Hicks

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

all inboxes | Powered by JetHome®