aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor/lsm.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2013-02-27 06:43:40 -0500
committerJohn Johansen <john.johansen@canonical.com>2013-04-28 03:39:35 -0400
commit214beacaa7b669473bc963af719fa359a8312ea4 (patch)
treee847f9c082c579f711a53f35442710af753aaf7f /security/apparmor/lsm.c
parent53fe8b9961716033571d9799005bfdbbafa5162c (diff)
apparmor: localize getting the security context to a few macros
Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Seth Arnold <seth.arnold@canonical.com>
Diffstat (limited to 'security/apparmor/lsm.c')
-rw-r--r--security/apparmor/lsm.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 10843aa5a368..2027fdf2060b 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -48,8 +48,8 @@ int apparmor_initialized __initdata;
48 */ 48 */
49static void apparmor_cred_free(struct cred *cred) 49static void apparmor_cred_free(struct cred *cred)
50{ 50{
51 aa_free_task_context(cred->security); 51 aa_free_task_context(cred_cxt(cred));
52 cred->security = NULL; 52 cred_cxt(cred) = NULL;
53} 53}
54 54
55/* 55/*
@@ -62,7 +62,7 @@ static int apparmor_cred_alloc_blank(struct cred *cred, gfp_t gfp)
62 if (!cxt) 62 if (!cxt)
63 return -ENOMEM; 63 return -ENOMEM;
64 64
65 cred->security = cxt; 65 cred_cxt(cred) = cxt;
66 return 0; 66 return 0;
67} 67}
68 68
@@ -77,8 +77,8 @@ static int apparmor_cred_prepare(struct cred *new, const struct cred *old,
77 if (!cxt) 77 if (!cxt)
78 return -ENOMEM; 78 return -ENOMEM;
79 79
80 aa_dup_task_context(cxt, old->security); 80 aa_dup_task_context(cxt, cred_cxt(old));
81 new->security = cxt; 81 cred_cxt(new) = cxt;
82 return 0; 82 return 0;
83} 83}
84 84
@@ -87,8 +87,8 @@ static int apparmor_cred_prepare(struct cred *new, const struct cred *old,
87 */ 87 */
88static void apparmor_cred_transfer(struct cred *new, const struct cred *old) 88static void apparmor_cred_transfer(struct cred *new, const struct cred *old)
89{ 89{
90 const struct aa_task_cxt *old_cxt = old->security; 90 const struct aa_task_cxt *old_cxt = cred_cxt(old);
91 struct aa_task_cxt *new_cxt = new->security; 91 struct aa_task_cxt *new_cxt = cred_cxt(new);
92 92
93 aa_dup_task_context(new_cxt, old_cxt); 93 aa_dup_task_context(new_cxt, old_cxt);
94} 94}
@@ -507,7 +507,7 @@ static int apparmor_getprocattr(struct task_struct *task, char *name,
507 int error = -ENOENT; 507 int error = -ENOENT;
508 /* released below */ 508 /* released below */
509 const struct cred *cred = get_task_cred(task); 509 const struct cred *cred = get_task_cred(task);
510 struct aa_task_cxt *cxt = cred->security; 510 struct aa_task_cxt *cxt = cred_cxt(cred);
511 511
512 if (strcmp(name, "current") == 0) 512 if (strcmp(name, "current") == 0)
513 error = aa_getprocattr(aa_newest_version(cxt->profile), 513 error = aa_getprocattr(aa_newest_version(cxt->profile),
@@ -880,7 +880,7 @@ static int __init set_init_cxt(void)
880 return -ENOMEM; 880 return -ENOMEM;
881 881
882 cxt->profile = aa_get_profile(root_ns->unconfined); 882 cxt->profile = aa_get_profile(root_ns->unconfined);
883 cred->security = cxt; 883 cred_cxt(cred) = cxt;
884 884
885 return 0; 885 return 0;
886} 886}
@@ -910,8 +910,8 @@ static int __init apparmor_init(void)
910 error = register_security(&apparmor_ops); 910 error = register_security(&apparmor_ops);
911 if (error) { 911 if (error) {
912 struct cred *cred = (struct cred *)current->real_cred; 912 struct cred *cred = (struct cred *)current->real_cred;
913 aa_free_task_context(cred->security); 913 aa_free_task_context(cred_cxt(cred));
914 cred->security = NULL; 914 cred_cxt(cred) = NULL;
915 AA_ERROR("Unable to register AppArmor\n"); 915 AA_ERROR("Unable to register AppArmor\n");
916 goto register_security_out; 916 goto register_security_out;
917 } 917 }