aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2018-02-05 03:58:29 -0500
committerJohn Johansen <john.johansen@canonical.com>2018-02-09 14:30:02 -0500
commitcf91600071a973c28cebf314e618610a20ec4d6d (patch)
tree3086f28c560f00327057a54f71159ebcdf6775cd
parentd901d6a298dc6e9105b9dc091d65b043e9f8c9a6 (diff)
apparmor: cleanup create_aafs() error path
Signed-off-by: John Johansen <john.johansen@canonical.com>
-rw-r--r--security/apparmor/apparmorfs.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 07623fb41e32..8cdab3c5bc63 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2458,34 +2458,26 @@ static int __init aa_create_aafs(void)
2458 2458
2459 dent = securityfs_create_file(".load", 0666, aa_sfs_entry.dentry, 2459 dent = securityfs_create_file(".load", 0666, aa_sfs_entry.dentry,
2460 NULL, &aa_fs_profile_load); 2460 NULL, &aa_fs_profile_load);
2461 if (IS_ERR(dent)) { 2461 if (IS_ERR(dent))
2462 error = PTR_ERR(dent); 2462 goto dent_error;
2463 goto error;
2464 }
2465 ns_subload(root_ns) = dent; 2463 ns_subload(root_ns) = dent;
2466 2464
2467 dent = securityfs_create_file(".replace", 0666, aa_sfs_entry.dentry, 2465 dent = securityfs_create_file(".replace", 0666, aa_sfs_entry.dentry,
2468 NULL, &aa_fs_profile_replace); 2466 NULL, &aa_fs_profile_replace);
2469 if (IS_ERR(dent)) { 2467 if (IS_ERR(dent))
2470 error = PTR_ERR(dent); 2468 goto dent_error;
2471 goto error;
2472 }
2473 ns_subreplace(root_ns) = dent; 2469 ns_subreplace(root_ns) = dent;
2474 2470
2475 dent = securityfs_create_file(".remove", 0666, aa_sfs_entry.dentry, 2471 dent = securityfs_create_file(".remove", 0666, aa_sfs_entry.dentry,
2476 NULL, &aa_fs_profile_remove); 2472 NULL, &aa_fs_profile_remove);
2477 if (IS_ERR(dent)) { 2473 if (IS_ERR(dent))
2478 error = PTR_ERR(dent); 2474 goto dent_error;
2479 goto error;
2480 }
2481 ns_subremove(root_ns) = dent; 2475 ns_subremove(root_ns) = dent;
2482 2476
2483 dent = securityfs_create_file("revision", 0444, aa_sfs_entry.dentry, 2477 dent = securityfs_create_file("revision", 0444, aa_sfs_entry.dentry,
2484 NULL, &aa_fs_ns_revision_fops); 2478 NULL, &aa_fs_ns_revision_fops);
2485 if (IS_ERR(dent)) { 2479 if (IS_ERR(dent))
2486 error = PTR_ERR(dent); 2480 goto dent_error;
2487 goto error;
2488 }
2489 ns_subrevision(root_ns) = dent; 2481 ns_subrevision(root_ns) = dent;
2490 2482
2491 /* policy tree referenced by magic policy symlink */ 2483 /* policy tree referenced by magic policy symlink */
@@ -2499,10 +2491,8 @@ static int __init aa_create_aafs(void)
2499 /* magic symlink similar to nsfs redirects based on task policy */ 2491 /* magic symlink similar to nsfs redirects based on task policy */
2500 dent = securityfs_create_symlink("policy", aa_sfs_entry.dentry, 2492 dent = securityfs_create_symlink("policy", aa_sfs_entry.dentry,
2501 NULL, &policy_link_iops); 2493 NULL, &policy_link_iops);
2502 if (IS_ERR(dent)) { 2494 if (IS_ERR(dent))
2503 error = PTR_ERR(dent); 2495 goto dent_error;
2504 goto error;
2505 }
2506 2496
2507 error = aa_mk_null_file(aa_sfs_entry.dentry); 2497 error = aa_mk_null_file(aa_sfs_entry.dentry);
2508 if (error) 2498 if (error)
@@ -2514,6 +2504,8 @@ static int __init aa_create_aafs(void)
2514 aa_info_message("AppArmor Filesystem Enabled"); 2504 aa_info_message("AppArmor Filesystem Enabled");
2515 return 0; 2505 return 0;
2516 2506
2507dent_error:
2508 error = PTR_ERR(dent);
2517error: 2509error:
2518 aa_destroy_aafs(); 2510 aa_destroy_aafs();
2519 AA_ERROR("Error creating AppArmor securityfs\n"); 2511 AA_ERROR("Error creating AppArmor securityfs\n");