Skip to contentSkip to conversation

CVE-2022-50074: apparmor: Fix memleak in aa_simple_write_to_buffer()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jun 18, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

apparmor: Fix memleak in aa_simple_write_to_buffer()

When copy_from_user failed, the memory is freed by kvfree. however the management struct and data blob are allocated independently, so only kvfree(data) cause a memleak issue here. Use aa_put_loaddata(data) to fix this issue.

The Linux kernel CVE team has assigned CVE-2022-50074 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.17 with commit a6a52579e52b55448326db88bd9a5740e7c1a037 and fixed in 4.19.256 with commit 6500eb3a48ac221051b1791818a1ac74744ef617
	Issue introduced in 4.17 with commit a6a52579e52b55448326db88bd9a5740e7c1a037 and fixed in 5.4.211 with commit 7db182a2ebeefded86fea542fcc5d6a68bb77f58
	Issue introduced in 4.17 with commit a6a52579e52b55448326db88bd9a5740e7c1a037 and fixed in 5.10.138 with commit 8aab4295582eb397a125d2788b829fa62b88dbf7
	Issue introduced in 4.17 with commit a6a52579e52b55448326db88bd9a5740e7c1a037 and fixed in 5.15.63 with commit bf7ebebce2c25071c719fd8a2f1307e0c243c2d7
	Issue introduced in 4.17 with commit a6a52579e52b55448326db88bd9a5740e7c1a037 and fixed in 5.19.4 with commit 6583edbf459de2e06b9759f264c0ae27e452b97a
	Issue introduced in 4.17 with commit a6a52579e52b55448326db88bd9a5740e7c1a037 and fixed in 6.0 with commit 417ea9fe972d2654a268ad66e89c8fcae67017c3

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-50074

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/6500eb3a48ac221051b1791818a1ac74744ef617
	https://git.kernel.org/stable/c/7db182a2ebeefded86fea542fcc5d6a68bb77f58
	https://git.kernel.org/stable/c/8aab4295582eb397a125d2788b829fa62b88dbf7
	https://git.kernel.org/stable/c/bf7ebebce2c25071c719fd8a2f1307e0c243c2d7
	https://git.kernel.org/stable/c/6583edbf459de2e06b9759f264c0ae27e452b97a
	https://git.kernel.org/stable/c/417ea9fe972d2654a268ad66e89c8fcae67017c3