Skip to contentSkip to conversation

CVE-2022-49212: mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Feb 26, 2025

lore
Share & tools
lore
#0 lore raw

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

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

mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init

The reference counting issue happens in several error handling paths on a refcounted object "nc->dmac". In these paths, the function simply returns the error code, forgetting to balance the reference count of "nc->dmac", increased earlier by dma_request_channel(), which may cause refcount leaks.

Fix it by decrementing the refcount of specific object in those error paths.

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

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

	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 4.14.276 with commit 0856bf27057561f42b37df111603cf5a0d040294
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 4.19.238 with commit 9843c9c98f26c6ad843260b19bfdaa2598f2ae1e
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 5.4.189 with commit 9b08d211db4c447eb1a07df65e45e0aa772e0fa6
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 5.10.110 with commit a3587259ae553e41d1ce8c7435351a5d6b299a11
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 5.15.33 with commit fe0e2ce5c87e9c0b9485ff566362030aa55972cf
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 5.16.19 with commit 8baea2b96fa90af8d0f937caf4cf2105ee094d93
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 5.17.2 with commit f1694169f3674cdf7553aed06864254635679878
	Issue introduced in 4.12 with commit f88fc122cc34c2545dec9562eaab121494e401ef and fixed in 5.18 with commit fecbd4a317c95d73c849648c406bcf1b6a0ec1cf

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

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:
drivers/mtd/nand/raw/atmel/nand-controller.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/0856bf27057561f42b37df111603cf5a0d040294
	https://git.kernel.org/stable/c/9843c9c98f26c6ad843260b19bfdaa2598f2ae1e
	https://git.kernel.org/stable/c/9b08d211db4c447eb1a07df65e45e0aa772e0fa6
	https://git.kernel.org/stable/c/a3587259ae553e41d1ce8c7435351a5d6b299a11
	https://git.kernel.org/stable/c/fe0e2ce5c87e9c0b9485ff566362030aa55972cf
	https://git.kernel.org/stable/c/8baea2b96fa90af8d0f937caf4cf2105ee094d93
	https://git.kernel.org/stable/c/f1694169f3674cdf7553aed06864254635679878
	https://git.kernel.org/stable/c/fecbd4a317c95d73c849648c406bcf1b6a0ec1cf