From cd0509177f055102b7d463599b0805ca25ddbb6d Mon Sep 17 00:00:00 2001 From: Liang He Date: Sun, 16 Mar 2025 07:39:20 +0000 Subject: [PATCH] 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 ccd7567d4b6cf187fdfa55f003a9e461ee629e36 ] 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: Liang He Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Signed-off-by: Zhang Kunbo --- drivers/cpufreq/pmac32-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index e225edb5c359..ce0dda1a4241 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -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 */ -- Gitee