CVE-2022-50754: apparmor: fix a memleak in multi_transaction_new()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
apparmor: fix a memleak in multi_transaction_new()
In multi_transaction_new(), the variable t is not freed or passed out on the failure of copy_from_user(t->data, buf, size), which could lead to a memleak.
Fix this bug by adding a put_multi_transaction(t) in the error path.
The Linux kernel CVE team has assigned CVE-2022-50754 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 4.14.303 with commit 11d5fe7da67c3334cefc981297fd5defb78df15c Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 4.19.270 with commit 95e6adc6a7a4761ddf69ad713e55a06a3206309d Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 5.4.229 with commit eb0f78e28cbc8f97439c0a4c80ee5160c1df5ce6 Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 5.10.163 with commit 935d86b29093e75b6c547d90b3979c2c2d23f1c4 Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 5.15.86 with commit 775a37ffa9f4681c4ad84c8634a7eec8af7098d4 Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 6.0.16 with commit 88989932c2269ea66074f52a6213598838f8b9e7 Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 6.1.2 with commit 3d27a436e294ac5d7a51bd5348ca63a42a468b35 Issue introduced in 4.13 with commit 1dea3b41e84c5923173fe654dcb758a5cb4a46e5 and fixed in 6.2 with commit c73275cf6834787ca090317f1d20dbfa3b7f05aa
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-50754
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/apparmor/apparmorfs.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/11d5fe7da67c3334cefc981297fd5defb78df15c https://git.kernel.org/stable/c/95e6adc6a7a4761ddf69ad713e55a06a3206309d https://git.kernel.org/stable/c/eb0f78e28cbc8f97439c0a4c80ee5160c1df5ce6 https://git.kernel.org/stable/c/935d86b29093e75b6c547d90b3979c2c2d23f1c4 https://git.kernel.org/stable/c/775a37ffa9f4681c4ad84c8634a7eec8af7098d4 https://git.kernel.org/stable/c/88989932c2269ea66074f52a6213598838f8b9e7 https://git.kernel.org/stable/c/3d27a436e294ac5d7a51bd5348ca63a42a468b35 https://git.kernel.org/stable/c/c73275cf6834787ca090317f1d20dbfa3b7f05aa