summaryrefslogtreecommitdiffstats
path: root/security/apparmor/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/apparmor/context.c')
-rw-r--r--security/apparmor/context.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/security/apparmor/context.c b/security/apparmor/context.c
index 70e4a094add8..d95a3d47cb92 100644
--- a/security/apparmor/context.c
+++ b/security/apparmor/context.c
@@ -156,8 +156,7 @@ int aa_set_current_onexec(struct aa_label *label, bool stack)
*/
int aa_set_current_hat(struct aa_label *label, u64 token)
{
- struct aa_task_ctx *tctx = current_task_ctx();
- struct aa_cred_ctx *ctx;
+ struct aa_task_ctx *ctx = current_task_ctx();
struct cred *new;
new = prepare_creds();
@@ -165,11 +164,11 @@ int aa_set_current_hat(struct aa_label *label, u64 token)
return -ENOMEM;
AA_BUG(!label);
- if (!tctx->previous) {
+ if (!ctx->previous) {
/* transfer refcount */
- tctx->previous = cred_label(new);
- tctx->token = token;
- } else if (tctx->token == token) {
+ ctx->previous = cred_label(new);
+ ctx->token = token;
+ } else if (ctx->token == token) {
aa_put_label(cred_label(new));
} else {
/* previous_profile && ctx->token != token */
@@ -179,8 +178,8 @@ int aa_set_current_hat(struct aa_label *label, u64 token)
cred_label(new) = aa_get_newest_label(label);
/* clear exec on switching context */
- aa_put_label(tctx->onexec);
- tctx->onexec = NULL;
+ aa_put_label(ctx->onexec);
+ ctx->onexec = NULL;
commit_creds(new);
return 0;
@@ -197,13 +196,13 @@ int aa_set_current_hat(struct aa_label *label, u64 token)
*/
int aa_restore_previous_label(u64 token)
{
- struct aa_task_ctx *tctx = current_task_ctx();
+ struct aa_task_ctx *ctx = current_task_ctx();
struct cred *new;
- if (tctx->token != token)
+ if (ctx->token != token)
return -EACCES;
/* ignore restores when there is no saved label */
- if (!tctx->previous)
+ if (!ctx->previous)
return 0;
new = prepare_creds();
@@ -211,10 +210,10 @@ int aa_restore_previous_label(u64 token)
return -ENOMEM;
aa_put_label(cred_label(new));
- cred_label(new) = aa_get_newest_label(tctx->previous);
+ cred_label(new) = aa_get_newest_label(ctx->previous);
AA_BUG(!cred_label(new));
/* clear exec && prev information when restoring to previous context */
- aa_clear_task_ctx_trans(tctx);
+ aa_clear_task_ctx_trans(ctx);
commit_creds(new);