From: John Johansen Date: Thu, 19 Dec 2019 23:55:39 +0000 (-0800) Subject: apparmor: fail unpack if profile mode is unknown X-Git-Tag: v5.8-rc1~102^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f05841a940df995b784b5e3ec6f76141e8337245;p=thirdparty%2Fkernel%2Flinux.git apparmor: fail unpack if profile mode is unknown Profile unpack should fail if the profile mode is not a mode that the kernel understands. Signed-off-by: John Johansen --- diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 80364310fb1e0..e4e329d695278 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -748,10 +748,14 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) goto fail; if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG)) profile->mode = APPARMOR_COMPLAIN; + else if (tmp == PACKED_MODE_ENFORCE) + profile->mode = APPARMOR_ENFORCE; else if (tmp == PACKED_MODE_KILL) profile->mode = APPARMOR_KILL; else if (tmp == PACKED_MODE_UNCONFINED) profile->mode = APPARMOR_UNCONFINED; + else + goto fail; if (!unpack_u32(e, &tmp, NULL)) goto fail; if (tmp)