Commit cd050917 authored by Liang He's avatar Liang He Committed by Zhang Kunbo
Browse files

cpufreq: pmac32-cpufreq: Fix refcount leak bug

stable inclusion
from stable-v4.19.253
commit 4585890ab2dbf455d80e254d3d859d4c1e357920
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBP6TT
CVE: CVE-2022-49621

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4585890ab2dbf455d80e254d3d859d4c1e357920



--------------------------------

[ Upstream commit ccd7567d ]

In pmac_cpufreq_init_MacRISC3(), we need to add corresponding
of_node_put() for the three node pointers whose refcount have
been incremented by of_find_node_by_name().

Signed-off-by: default avatarLiang He <windhl@126.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhang Kunbo <zhangkunbo@huawei.com>
parent d734d6bb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -474,6 +474,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
	if (slew_done_gpio_np)
		slew_done_gpio = read_gpio(slew_done_gpio_np);

	of_node_put(volt_gpio_np);
	of_node_put(freq_gpio_np);
	of_node_put(slew_done_gpio_np);

	/* If we use the frequency GPIOs, calculate the min/max speeds based
	 * on the bus frequencies
	 */