Merge branch 'pm-cpufreq'

Merge cpufreq fixes for 7.3-rc3:

  - Zero-initialize policy cpumask and initialize policy rwsem before
    exposing the policy sysfs interface (Runyu Xiao and Zhongqiu Han)

* pm-cpufreq:
  cpufreq: zero-initialize policy cpumask before sysfs publication
  cpufreq: initialize policy rwsem before sysfs publication
This commit is contained in:
Rafael J. Wysocki 2026-09-10 20:16:37 +02:00
commit 13b3dcbcfe

View File

@ -1249,7 +1249,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
if (!policy)
return NULL;
if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
if (!zalloc_cpumask_var(&policy->cpus, GFP_KERNEL))
goto err_free_policy;
if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
@ -1258,6 +1258,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL))
goto err_free_rcpumask;
init_rwsem(&policy->rwsem);
init_completion(&policy->kobj_unregister);
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
cpufreq_global_kobject, "policy%u", cpu);
@ -1272,8 +1274,6 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
goto err_free_real_cpus;
}
init_rwsem(&policy->rwsem);
freq_constraints_init(&policy->constraints);
policy->nb_min.notifier_call = cpufreq_notifier_min;