Skip to content

Commit e9e6fa4

Browse files
Xiu Jianfengjrjohansen
authored andcommitted
apparmor: Fix memleak in alloc_ns()
After changes in commit a1bd627 ("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: a1bd627 ("apparmor: share profile name on replacement") Signed-off-by: Xiu Jianfeng <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent 3265949 commit e9e6fa4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/apparmor/policy_ns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)
132132
return ns;
133133

134134
fail_unconfined:
135-
kfree_sensitive(ns->base.hname);
135+
aa_policy_destroy(&ns->base);
136136
fail_ns:
137137
kfree_sensitive(ns);
138138
return NULL;

0 commit comments

Comments
 (0)