CVE-2022-50201: selinux: fix memleak in security_read_state_kernel()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
selinux: fix memleak in security_read_state_kernel()
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.
[PM: subject line tweak]
The Linux kernel CVE team has assigned CVE-2022-50201 to this issue.
Affected and fixed versions
===========================
Fixed in 5.15.61 with commit c877c5217145bda8fd95f506bf42f8d981afa57d Fixed in 5.18.18 with commit f3cd7562c0a6774fc62d79654482014020e574f5 Fixed in 5.19.2 with commit 1fc1f72aad2070d34022d0823e4cf09706b53f25 Fixed in 6.0 with commit 73de1befcc53a7c68b0c5e76b9b5ac41c517760f
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2022-50201
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
security/selinux/ss/services.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/c877c5217145bda8fd95f506bf42f8d981afa57d https://git.kernel.org/stable/c/f3cd7562c0a6774fc62d79654482014020e574f5 https://git.kernel.org/stable/c/1fc1f72aad2070d34022d0823e4cf09706b53f25 https://git.kernel.org/stable/c/73de1befcc53a7c68b0c5e76b9b5ac41c517760f