Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipe: don't bother with removal of files in directory we'll be removing

... and use securityfs_remove() instead of securityfs_recursive_remove()

Acked-by: Fan Wu <wufan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 5be998a2 e25fc554

+14 -22
+12 -20
security/ipe/fs.c
··· 12 12 #include "policy.h" 13 13 #include "audit.h" 14 14 15 - static struct dentry *np __ro_after_init; 16 15 static struct dentry *root __ro_after_init; 17 16 struct dentry *policy_root __ro_after_init; 18 - static struct dentry *audit_node __ro_after_init; 19 - static struct dentry *enforce_node __ro_after_init; 20 17 21 18 /** 22 19 * setaudit() - Write handler for the securityfs node, "ipe/success_audit" ··· 197 200 { 198 201 int rc = 0; 199 202 struct ipe_policy *ap; 203 + struct dentry *dentry; 200 204 201 205 if (!ipe_enabled) 202 206 return -EOPNOTSUPP; 203 207 204 208 root = securityfs_create_dir("ipe", NULL); 205 - if (IS_ERR(root)) { 206 - rc = PTR_ERR(root); 207 - goto err; 208 - } 209 + if (IS_ERR(root)) 210 + return PTR_ERR(root); 209 211 210 - audit_node = securityfs_create_file("success_audit", 0600, root, 212 + dentry = securityfs_create_file("success_audit", 0600, root, 211 213 NULL, &audit_fops); 212 - if (IS_ERR(audit_node)) { 213 - rc = PTR_ERR(audit_node); 214 + if (IS_ERR(dentry)) { 215 + rc = PTR_ERR(dentry); 214 216 goto err; 215 217 } 216 218 217 - enforce_node = securityfs_create_file("enforce", 0600, root, NULL, 219 + dentry = securityfs_create_file("enforce", 0600, root, NULL, 218 220 &enforce_fops); 219 - if (IS_ERR(enforce_node)) { 220 - rc = PTR_ERR(enforce_node); 221 + if (IS_ERR(dentry)) { 222 + rc = PTR_ERR(dentry); 221 223 goto err; 222 224 } 223 225 ··· 233 237 goto err; 234 238 } 235 239 236 - np = securityfs_create_file("new_policy", 0200, root, NULL, &np_fops); 237 - if (IS_ERR(np)) { 238 - rc = PTR_ERR(np); 240 + dentry = securityfs_create_file("new_policy", 0200, root, NULL, &np_fops); 241 + if (IS_ERR(dentry)) { 242 + rc = PTR_ERR(dentry); 239 243 goto err; 240 244 } 241 245 242 246 return 0; 243 247 err: 244 - securityfs_remove(np); 245 - securityfs_remove(policy_root); 246 - securityfs_remove(enforce_node); 247 - securityfs_remove(audit_node); 248 248 securityfs_remove(root); 249 249 return rc; 250 250 }
+2 -2
security/ipe/policy_fs.c
··· 438 438 */ 439 439 void ipe_del_policyfs_node(struct ipe_policy *p) 440 440 { 441 - securityfs_recursive_remove(p->policyfs); 441 + securityfs_remove(p->policyfs); 442 442 p->policyfs = NULL; 443 443 } 444 444 ··· 485 485 486 486 return 0; 487 487 err: 488 - securityfs_recursive_remove(policyfs); 488 + securityfs_remove(policyfs); 489 489 return rc; 490 490 }