CVE-2022-49386: net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. am65_cpsw_init_cpts() and am65_cpsw_nuss_probe() don't release the refcount in error case.
Add missing of_node_put() to avoid refcount leak.
The Linux kernel CVE team has assigned CVE-2022-49386 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.7 with commit 93a76530316a3d8cc2d82c3deca48424fee92100 and fixed in 5.10.122 with commit f7ba2cc57f404d2d9f26fb85bd3833d35a477829 Issue introduced in 5.7 with commit 93a76530316a3d8cc2d82c3deca48424fee92100 and fixed in 5.15.47 with commit a4b7ef3b159805ba6be061d0cd2403d84b9b0063 Issue introduced in 5.7 with commit 93a76530316a3d8cc2d82c3deca48424fee92100 and fixed in 5.17.15 with commit 78aca10a16f001c9f49f1cc4dadfee8d444bb173 Issue introduced in 5.7 with commit 93a76530316a3d8cc2d82c3deca48424fee92100 and fixed in 5.18.4 with commit 2e44f21c384503562713b7d3b673c40bed20af3d Issue introduced in 5.7 with commit 93a76530316a3d8cc2d82c3deca48424fee92100 and fixed in 5.19 with commit 5dd89d2fc438457811cbbec07999ce0d80051ff5
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-49386
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/net/ethernet/ti/am65-cpsw-nuss.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/f7ba2cc57f404d2d9f26fb85bd3833d35a477829 https://git.kernel.org/stable/c/a4b7ef3b159805ba6be061d0cd2403d84b9b0063 https://git.kernel.org/stable/c/78aca10a16f001c9f49f1cc4dadfee8d444bb173 https://git.kernel.org/stable/c/2e44f21c384503562713b7d3b673c40bed20af3d https://git.kernel.org/stable/c/5dd89d2fc438457811cbbec07999ce0d80051ff5