aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-12-24 14:56:48 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-01-25 23:16:25 -0500
commitad52184b705c1048aa01225eccde119ef5c93000 (patch)
tree277863bcb923760dae10dfef1e647bdd5b23e314 /security/selinux
parentfb32c76d16aa40f3057f53273ac483a8e2468004 (diff)
selinuxfs: don't open-code d_genocide()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/selinuxfs.c52
1 files changed, 3 insertions, 49 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 33db1ad4fd10..1684bcc78b34 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1195,30 +1195,8 @@ static const struct file_operations sel_commit_bools_ops = {
1195 1195
1196static void sel_remove_entries(struct dentry *de) 1196static void sel_remove_entries(struct dentry *de)
1197{ 1197{
1198 struct list_head *node; 1198 d_genocide(de);
1199 1199 shrink_dcache_parent(de);
1200 spin_lock(&de->d_lock);
1201 node = de->d_subdirs.next;
1202 while (node != &de->d_subdirs) {
1203 struct dentry *d = list_entry(node, struct dentry, d_child);
1204
1205 spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED);
1206 list_del_init(node);
1207
1208 if (d->d_inode) {
1209 dget_dlock(d);
1210 spin_unlock(&de->d_lock);
1211 spin_unlock(&d->d_lock);
1212 d_delete(d);
1213 simple_unlink(de->d_inode, d);
1214 dput(d);
1215 spin_lock(&de->d_lock);
1216 } else
1217 spin_unlock(&d->d_lock);
1218 node = de->d_subdirs.next;
1219 }
1220
1221 spin_unlock(&de->d_lock);
1222} 1200}
1223 1201
1224#define BOOL_DIR_NAME "booleans" 1202#define BOOL_DIR_NAME "booleans"
@@ -1668,37 +1646,13 @@ static int sel_make_class_dir_entries(char *classname, int index,
1668 return rc; 1646 return rc;
1669} 1647}
1670 1648
1671static void sel_remove_classes(void)
1672{
1673 struct list_head *class_node;
1674
1675 list_for_each(class_node, &class_dir->d_subdirs) {
1676 struct dentry *class_subdir = list_entry(class_node,
1677 struct dentry, d_child);
1678 struct list_head *class_subdir_node;
1679
1680 list_for_each(class_subdir_node, &class_subdir->d_subdirs) {
1681 struct dentry *d = list_entry(class_subdir_node,
1682 struct dentry, d_child);
1683
1684 if (d->d_inode)
1685 if (d->d_inode->i_mode & S_IFDIR)
1686 sel_remove_entries(d);
1687 }
1688
1689 sel_remove_entries(class_subdir);
1690 }
1691
1692 sel_remove_entries(class_dir);
1693}
1694
1695static int sel_make_classes(void) 1649static int sel_make_classes(void)
1696{ 1650{
1697 int rc, nclasses, i; 1651 int rc, nclasses, i;
1698 char **classes; 1652 char **classes;
1699 1653
1700 /* delete any existing entries */ 1654 /* delete any existing entries */
1701 sel_remove_classes(); 1655 sel_remove_entries(class_dir);
1702 1656
1703 rc = security_get_classes(&classes, &nclasses); 1657 rc = security_get_classes(&classes, &nclasses);
1704 if (rc) 1658 if (rc)