CVE-2022-50161: mtd: maps: Fix refcount leak in of_flash_probe_versatile
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
mtd: maps: Fix refcount leak in of_flash_probe_versatile
of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
The Linux kernel CVE team has assigned CVE-2022-50161 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 4.14.291 with commit 3c8de6a838b7e0eb392754ac89dd66e698684342 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 4.19.256 with commit 79e57889aa0d92a6d769bad808fb105e7b6ea495 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.4.211 with commit 9124d51e01232a91da4034768a2a8d1688472179 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.10.137 with commit 52ae2b14f76ef2d490337ddc0037bc37125be7b8 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.15.61 with commit 4d67c8f74d804b20febf716ec96e9a475457ec60 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.18.18 with commit 5d5ddd8771fa9cabeb247fba5f6ab60d63f3fbce Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.19.2 with commit f516fbb63873ee23cba5b7c3d239677c30f13df8 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 6.0 with commit 33ec82a6d2b119938f26e5c8040ed5d92378eb54
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-50161
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/maps/physmap-versatile.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/3c8de6a838b7e0eb392754ac89dd66e698684342 https://git.kernel.org/stable/c/79e57889aa0d92a6d769bad808fb105e7b6ea495 https://git.kernel.org/stable/c/9124d51e01232a91da4034768a2a8d1688472179 https://git.kernel.org/stable/c/52ae2b14f76ef2d490337ddc0037bc37125be7b8 https://git.kernel.org/stable/c/4d67c8f74d804b20febf716ec96e9a475457ec60 https://git.kernel.org/stable/c/5d5ddd8771fa9cabeb247fba5f6ab60d63f3fbce https://git.kernel.org/stable/c/f516fbb63873ee23cba5b7c3d239677c30f13df8 https://git.kernel.org/stable/c/33ec82a6d2b119938f26e5c8040ed5d92378eb54