Explorar o código

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 <john.johansen@canonical.com>
John Johansen %!s(int64=9) %!d(string=hai) anos
pai
achega
5f20fdfed1
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      security/apparmor/policy_unpack.c

+ 3 - 0
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);
 			error = PTR_ERR(profile->policy.dfa);
 			profile->policy.dfa = NULL;
 			profile->policy.dfa = NULL;
 			goto fail;
 			goto fail;
+		} else if (!profile->policy.dfa) {
+			error = -EPROTO;
+			goto fail;
 		}
 		}
 		if (!unpack_u32(e, &profile->policy.start[0], "start"))
 		if (!unpack_u32(e, &profile->policy.start[0], "start"))
 			/* default start state */
 			/* default start state */