]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
selinux: fix memleak in security_read_state_kernel()
authorXiu Jianfeng <xiujianfeng@huawei.com>
Mon, 13 Jun 2022 13:59:53 +0000 (21:59 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 17 Oct 2022 09:55:57 +0000 (11:55 +0200)
commit18baef3d95822a6eecc07a8e2fd8929564914a94
tree46dd684a9d4a06a177ba6efd496769fe13b6f707
parent05bc812a237f40dea3f0a879a57f99a436a4e8ad
selinux: fix memleak in security_read_state_kernel()

BugLink: https://bugs.launchpad.net/bugs/1990162
[ Upstream commit 73de1befcc53a7c68b0c5e76b9b5ac41c517760f ]

In this function, it directly returns the result of __security_read_policy
without freeing the allocated memory in *data, cause memory leak issue,
so free the memory if __security_read_policy failed.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
[PM: subject line tweak]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
security/selinux/ss/services.c