From: John Johansen Date: Wed, 15 Nov 2017 23:25:30 +0000 (-0800) Subject: apparmor: fix leak of null profile name if profile allocation fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=897088926c3477ef8d3d299473a2777dd9d1c9cb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git apparmor: fix leak of null profile name if profile allocation fails [ Upstream commit 4633307e5ed6128975595df43f796a10c41d11c1 ] Fixes: d07881d2edb0 ("apparmor: move new_null_profile to after profile lookup fns()") Reported-by: Seth Arnold Signed-off-by: John Johansen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 4243b0c3f0e4..586b249d3b46 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -502,7 +502,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat, { struct aa_profile *p, *profile; const char *bname; - char *name; + char *name = NULL; AA_BUG(!parent); @@ -562,6 +562,7 @@ out: return profile; fail: + kfree(name); aa_free_profile(profile); return NULL; }