summaryrefslogtreecommitdiffstats
path: root/security/apparmor
diff options
context:
space:
mode:
authorXiu Jianfeng <xiujianfeng@huawei.com>2022-10-28 14:33:20 +0200
committerJohn Johansen <john.johansen@canonical.com>2022-11-01 13:32:13 +0100
commite9e6fa49dbab6d84c676666f3fe7d360497fd65b (patch)
tree3f051f39d83e887cf281e24fa11fd792f2f8ff34 /security/apparmor
parentapparmor: Fix memleak issue in unpack_profile() (diff)
downloadlinux-e9e6fa49dbab6d84c676666f3fe7d360497fd65b.tar.xz
linux-e9e6fa49dbab6d84c676666f3fe7d360497fd65b.zip
apparmor: Fix memleak in alloc_ns()
After changes in commit a1bd627b46d1 ("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: a1bd627b46d1 ("apparmor: share profile name on replacement") Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor')
-rw-r--r--security/apparmor/policy_ns.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c
index 5c38563a6dcf..fd5b7afbcb48 100644
--- a/security/apparmor/policy_ns.c
+++ b/security/apparmor/policy_ns.c
@@ -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;