mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing
of_parse_phandle_with_args() transfers a reference to the provider node
in out_args->np, which the caller is responsible for releasing with
of_node_put(). Neither qcom_get_related_cpus() nor
qcom_cpufreq_hw_cpu_init() ever puts args.np: they only put cpu_np, which
is a different node obtained from of_cpu_device_node_get(). The
reference is therefore leaked on every successful call, and
qcom_get_related_cpus() leaks one per present CPU.
Release args.np after the parsed index has been read in both call sites.
Fixes: 2849dd8bc7 ("cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
95cc3927ce
commit
6fa50b1988
|
|
@ -322,6 +322,8 @@ static void qcom_get_related_cpus(int index, struct cpumask *m)
|
|||
|
||||
if (index == args.args[0])
|
||||
cpumask_set_cpu(cpu, m);
|
||||
|
||||
of_node_put(args.np);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -554,6 +556,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
|
|||
return ret;
|
||||
|
||||
index = args.args[0];
|
||||
of_node_put(args.np);
|
||||
data = &qcom_cpufreq.data[index];
|
||||
|
||||
/* HW should be in enabled state to proceed */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user