From: John Johansen Date: Wed, 15 Jun 2016 07:00:55 +0000 (+0300) Subject: apparmor: fix oops in profile_unpack() when policy_db is not present X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5f20fdfed16bc599a325a145bf0123a8e1c9beea;p=linux-beck.git apparmor: fix oops in profile_unpack() when policy_db is not present BugLink: http://bugs.launchpad.net/bugs/1592547 If unpack_dfa() returns NULL due to the dfa not being present, profile_unpack() is not checking if the dfa is not present (NULL). Signed-off-by: John Johansen --- diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 951ae4633979..b9b1c66a32a5 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -583,6 +583,9 @@ static struct aa_profile *unpack_profile(struct aa_ext *e) error = PTR_ERR(profile->policy.dfa); profile->policy.dfa = NULL; goto fail; + } else if (!profile->policy.dfa) { + error = -EPROTO; + goto fail; } if (!unpack_u32(e, &profile->policy.start[0], "start")) /* default start state */