diff options
author | Xiu Jianfeng <xiujianfeng@huawei.com> | 2022-10-28 15:33:20 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-31 15:32:31 +0300 |
commit | 12695b4b76d437b9c0182a6f7dfb2248013a9daf (patch) | |
tree | 4d018fa36498f5c050caf94ab6db270db7c934fe /security | |
parent | 7417cc5151bc3394ad9a9d501282ea09b79b54b0 (diff) | |
download | linux-12695b4b76d437b9c0182a6f7dfb2248013a9daf.tar.xz |
apparmor: Fix memleak in alloc_ns()
[ Upstream commit e9e6fa49dbab6d84c676666f3fe7d360497fd65b ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/policy_ns.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c index 43beaad083fe..78700d94b453 100644 --- a/security/apparmor/policy_ns.c +++ b/security/apparmor/policy_ns.c @@ -134,7 +134,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; |