From a20aa95fbe1abb4c6f333a1f55e9fd15b01c7f12 Mon Sep 17 00:00:00 2001 From: John Johansen Date: Mon, 16 Jan 2017 00:42:59 -0800 Subject: [PATCH] apparmor: fail task profile update if current_cred isn't real_cred Trying to update the task cred while the task current cred is not the real cred will result in an error at the cred layer. Avoid this by failing early and delaying the update. Signed-off-by: John Johansen --- security/apparmor/context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/security/apparmor/context.c b/security/apparmor/context.c index 3c4f534ef88c..3f32f594c999 100644 --- a/security/apparmor/context.c +++ b/security/apparmor/context.c @@ -100,6 +100,9 @@ int aa_replace_current_profile(struct aa_profile *profile) if (cxt->profile == profile) return 0; + if (current_cred() != current_real_cred()) + return -EBUSY; + new = prepare_creds(); if (!new) return -ENOMEM; -- 2.20.1