apparmor: fix oops in profile_unpack() when policy_db is not present
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / security / apparmor / policy_unpack.c
index 6b221354f0aa769f5c3a6f75e65e4be7aff001d8..55ff3eecd368f8203059f06ad43ac145632133b9 100644 (file)
@@ -571,6 +571,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 */