diff options
author | John Johansen <john.johansen@canonical.com> | 2013-02-27 06:43:40 -0500 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2013-04-28 03:39:35 -0400 |
commit | 214beacaa7b669473bc963af719fa359a8312ea4 (patch) | |
tree | e847f9c082c579f711a53f35442710af753aaf7f /security/apparmor/include | |
parent | 53fe8b9961716033571d9799005bfdbbafa5162c (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/include')
-rw-r--r-- | security/apparmor/include/context.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/security/apparmor/include/context.h b/security/apparmor/include/context.h index 4cecad313227..d44ba5802e3d 100644 --- a/security/apparmor/include/context.h +++ b/security/apparmor/include/context.h | |||
@@ -21,6 +21,9 @@ | |||
21 | 21 | ||
22 | #include "policy.h" | 22 | #include "policy.h" |
23 | 23 | ||
24 | #define cred_cxt(X) (X)->security | ||
25 | #define current_cxt() cred_cxt(current_cred()) | ||
26 | |||
24 | /* struct aa_file_cxt - the AppArmor context the file was opened in | 27 | /* struct aa_file_cxt - the AppArmor context the file was opened in |
25 | * @perms: the permission the file was opened with | 28 | * @perms: the permission the file was opened with |
26 | * | 29 | * |
@@ -93,7 +96,7 @@ struct aa_profile *aa_get_task_profile(struct task_struct *task); | |||
93 | */ | 96 | */ |
94 | static inline struct aa_profile *aa_cred_profile(const struct cred *cred) | 97 | static inline struct aa_profile *aa_cred_profile(const struct cred *cred) |
95 | { | 98 | { |
96 | struct aa_task_cxt *cxt = cred->security; | 99 | struct aa_task_cxt *cxt = cred_cxt(cred); |
97 | BUG_ON(!cxt || !cxt->profile); | 100 | BUG_ON(!cxt || !cxt->profile); |
98 | return aa_newest_version(cxt->profile); | 101 | return aa_newest_version(cxt->profile); |
99 | } | 102 | } |
@@ -145,7 +148,7 @@ static inline struct aa_profile *__aa_current_profile(void) | |||
145 | */ | 148 | */ |
146 | static inline struct aa_profile *aa_current_profile(void) | 149 | static inline struct aa_profile *aa_current_profile(void) |
147 | { | 150 | { |
148 | const struct aa_task_cxt *cxt = current_cred()->security; | 151 | const struct aa_task_cxt *cxt = current_cxt(); |
149 | struct aa_profile *profile; | 152 | struct aa_profile *profile; |
150 | BUG_ON(!cxt || !cxt->profile); | 153 | BUG_ON(!cxt || !cxt->profile); |
151 | 154 | ||