mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
[PATCH] selinuxfs cleanups: sel_fill_super exit path
Unify the error path of sel_fill_super() so that all errors pass through the same point and generate an error message. Also, removes a spurious dput() in the error path which breaks the refcounting for the filesystem (litter_kill_super() will correctly clean things up itself on error). Signed-off-by: James Morris <jmorris@namei.org> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
cde174a885
commit
161ce45a8a
1 changed files with 24 additions and 17 deletions
|
@ -1213,28 +1213,34 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
|
||||||
};
|
};
|
||||||
ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files);
|
ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err;
|
||||||
|
|
||||||
dentry = d_alloc_name(sb->s_root, BOOL_DIR_NAME);
|
dentry = d_alloc_name(sb->s_root, BOOL_DIR_NAME);
|
||||||
if (!dentry)
|
if (!dentry) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
ret = sel_make_dir(sb, dentry);
|
ret = sel_make_dir(sb, dentry);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err;
|
||||||
|
|
||||||
bool_dir = dentry;
|
bool_dir = dentry;
|
||||||
ret = sel_make_bools();
|
ret = sel_make_bools();
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto err;
|
||||||
|
|
||||||
dentry = d_alloc_name(sb->s_root, NULL_FILE_NAME);
|
dentry = d_alloc_name(sb->s_root, NULL_FILE_NAME);
|
||||||
if (!dentry)
|
if (!dentry) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
inode = sel_make_inode(sb, S_IFCHR | S_IRUGO | S_IWUGO);
|
inode = sel_make_inode(sb, S_IFCHR | S_IRUGO | S_IWUGO);
|
||||||
if (!inode)
|
if (!inode) {
|
||||||
goto out;
|
ret = -ENOMEM;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
isec = (struct inode_security_struct*)inode->i_security;
|
isec = (struct inode_security_struct*)inode->i_security;
|
||||||
isec->sid = SECINITSID_DEVNULL;
|
isec->sid = SECINITSID_DEVNULL;
|
||||||
isec->sclass = SECCLASS_CHR_FILE;
|
isec->sclass = SECCLASS_CHR_FILE;
|
||||||
|
@ -1245,22 +1251,23 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
|
||||||
selinux_null = dentry;
|
selinux_null = dentry;
|
||||||
|
|
||||||
dentry = d_alloc_name(sb->s_root, "avc");
|
dentry = d_alloc_name(sb->s_root, "avc");
|
||||||
if (!dentry)
|
if (!dentry) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
ret = sel_make_dir(sb, dentry);
|
ret = sel_make_dir(sb, dentry);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto err;
|
||||||
|
|
||||||
ret = sel_make_avc_files(dentry);
|
ret = sel_make_avc_files(dentry);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto err;
|
||||||
|
|
||||||
return 0;
|
|
||||||
out:
|
out:
|
||||||
dput(dentry);
|
return ret;
|
||||||
|
err:
|
||||||
printk(KERN_ERR "%s: failed while creating inodes\n", __FUNCTION__);
|
printk(KERN_ERR "%s: failed while creating inodes\n", __FUNCTION__);
|
||||||
return -ENOMEM;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct super_block *sel_get_sb(struct file_system_type *fs_type,
|
static struct super_block *sel_get_sb(struct file_system_type *fs_type,
|
||||||
|
|
Loading…
Reference in a new issue