CVE-2022-50160: mtd: maps: Fix refcount leak in ap_flash_init
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
mtd: maps: Fix refcount leak in ap_flash_init
of_find_matching_node() 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-50160 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 4.14.291 with commit 995fb2874bb5696357846a91e59181c600e6aac8 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 4.19.256 with commit d10855876a6f47add6ff621cef25cc0171dac162 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.4.211 with commit 80b1465b2ae81ebb59bbe62bcb7a7f7d4e9ece6f Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.10.137 with commit 941ef6997f9db704fe4fd62fc01e420fdd5048b2 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.15.61 with commit d5730780e9ea84e5476752a47c749036c6a74af5 Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.18.18 with commit a74322d4b897ddc268b340c4a397f6066c2f945d Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 5.19.2 with commit babd7b0124650ab71a6487e38588b8659b3aa2dc Issue introduced in 4.7 with commit b0afd44bc192ff4c0e90a5fc1724350bcfc32b33 and fixed in 6.0 with commit 77087a04c8fd554134bddcb8a9ff87b21f357926
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-50160
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/995fb2874bb5696357846a91e59181c600e6aac8 https://git.kernel.org/stable/c/d10855876a6f47add6ff621cef25cc0171dac162 https://git.kernel.org/stable/c/80b1465b2ae81ebb59bbe62bcb7a7f7d4e9ece6f https://git.kernel.org/stable/c/941ef6997f9db704fe4fd62fc01e420fdd5048b2 https://git.kernel.org/stable/c/d5730780e9ea84e5476752a47c749036c6a74af5 https://git.kernel.org/stable/c/a74322d4b897ddc268b340c4a397f6066c2f945d https://git.kernel.org/stable/c/babd7b0124650ab71a6487e38588b8659b3aa2dc https://git.kernel.org/stable/c/77087a04c8fd554134bddcb8a9ff87b21f357926