Commit e9e6fa49 authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by John Johansen

apparmor: Fix memleak in alloc_ns()

After changes in commit a1bd627b ("apparmor: share profile name on
replacement"), the hname member of struct aa_policy is not valid slab
object, but a subset of that, it can not be freed by kfree_sensitive(),
use aa_policy_destroy() to fix it.

Fixes: a1bd627b ("apparmor: share profile name on replacement")
Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent 3265949f
......@@ -132,7 +132,7 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)
return ns;
fail_unconfined:
kfree_sensitive(ns->base.hname);
aa_policy_destroy(&ns->base);
fail_ns:
kfree_sensitive(ns);
return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment