]> git.baikalelectronics.ru Git - 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:04 +0000 (14:23 +0200)
commitc6d11caf3a66256769e278a3adb2e1c646b5325c
tree9ff94f66abee7ea6e915df5f9077b76a8c81f7e7
parent6e7862e80dd47fe0508c539bef04195f881da40f
selinux: fix memleak in security_read_state_kernel()

[ Upstream commit 7b273980973b320b2644c2e296abd5b1926904a0 ]

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>
security/selinux/ss/services.c