aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/selinuxfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/selinuxfs.c')
-rw-r--r--security/selinux/selinuxfs.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 073fd5b0a53a..43deac219491 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1145,24 +1145,28 @@ static void sel_remove_entries(struct dentry *de)
1145{ 1145{
1146 struct list_head *node; 1146 struct list_head *node;
1147 1147
1148 spin_lock(&dcache_lock); 1148 spin_lock(&de->d_lock);
1149 node = de->d_subdirs.next; 1149 node = de->d_subdirs.next;
1150 while (node != &de->d_subdirs) { 1150 while (node != &de->d_subdirs) {
1151 struct dentry *d = list_entry(node, struct dentry, d_u.d_child); 1151 struct dentry *d = list_entry(node, struct dentry, d_u.d_child);
1152
1153 spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED);
1152 list_del_init(node); 1154 list_del_init(node);
1153 1155
1154 if (d->d_inode) { 1156 if (d->d_inode) {
1155 d = dget_locked(d); 1157 dget_dlock(d);
1156 spin_unlock(&dcache_lock); 1158 spin_unlock(&de->d_lock);
1159 spin_unlock(&d->d_lock);
1157 d_delete(d); 1160 d_delete(d);
1158 simple_unlink(de->d_inode, d); 1161 simple_unlink(de->d_inode, d);
1159 dput(d); 1162 dput(d);
1160 spin_lock(&dcache_lock); 1163 spin_lock(&de->d_lock);
1161 } 1164 } else
1165 spin_unlock(&d->d_lock);
1162 node = de->d_subdirs.next; 1166 node = de->d_subdirs.next;
1163 } 1167 }
1164 1168
1165 spin_unlock(&dcache_lock); 1169 spin_unlock(&de->d_lock);
1166} 1170}
1167 1171
1168#define BOOL_DIR_NAME "booleans" 1172#define BOOL_DIR_NAME "booleans"