Skip to contentSkip to conversation

CVE-2022-50887: regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 30, 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:

regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()

I got the the following report:

OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry:
attach overlay node /i2c/pmic@62/regulators/exten

In of_get_regulator(), the node is returned from of_parse_phandle() with refcount incremented, after using it, of_node_put() need be called.

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

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

	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 4.9.337 with commit 0e88505ac0a6ae97746bcdbd4b042ee9f20455ae
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 4.14.303 with commit 4dfcf5087db9a34a300d6b99009232d4537c3e6a
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 4.19.270 with commit 3ac888db0f67813d91373a9a61c840f815cd4ec9
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 5.4.229 with commit d39937f8de641c44a337cec4a2e5d3e8add20a7d
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 5.10.163 with commit f48c474efe05cf9ce5e535b5e0ddd710e963936c
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 5.15.86 with commit cda1895f3b7f324ece1614308a815a3994983b97
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 6.0.16 with commit 2b93c58adddd98812ad928bbc2063038f3df1ffd
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 6.1.2 with commit 2f98469c3141f8e42ba11075a273fb795bbad57f
	Issue introduced in 3.3 with commit 69511a452e6dc6b74fe4f3671a51b1b44b9c57e3 and fixed in 6.2 with commit f2b41b748c19962b82709d9f23c6b2b0ce9d2f91

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

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/regulator/core.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/0e88505ac0a6ae97746bcdbd4b042ee9f20455ae
	https://git.kernel.org/stable/c/4dfcf5087db9a34a300d6b99009232d4537c3e6a
	https://git.kernel.org/stable/c/3ac888db0f67813d91373a9a61c840f815cd4ec9
	https://git.kernel.org/stable/c/d39937f8de641c44a337cec4a2e5d3e8add20a7d
	https://git.kernel.org/stable/c/f48c474efe05cf9ce5e535b5e0ddd710e963936c
	https://git.kernel.org/stable/c/cda1895f3b7f324ece1614308a815a3994983b97
	https://git.kernel.org/stable/c/2b93c58adddd98812ad928bbc2063038f3df1ffd
	https://git.kernel.org/stable/c/2f98469c3141f8e42ba11075a273fb795bbad57f
	https://git.kernel.org/stable/c/f2b41b748c19962b82709d9f23c6b2b0ce9d2f91