[kernel] Fix intel_pstate init error path (rhbz 916833)

Josh Boyer jwboyer at fedoraproject.org
Wed Mar 6 02:19:35 UTC 2013


commit 3ce66bca1d49f88d7611c9db02d076739a6d7719
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Tue Mar 5 21:19:33 2013 -0500

    Fix intel_pstate init error path (rhbz 916833)

 ...l_pstate-Fix-intel_pstate_init-error-path.patch |   76 ++++++++++++++++++++
 kernel.spec                                        |    9 ++-
 2 files changed, 83 insertions(+), 2 deletions(-)
---
diff --git a/intel_pstate-Fix-intel_pstate_init-error-path.patch b/intel_pstate-Fix-intel_pstate_init-error-path.patch
new file mode 100644
index 0000000..21c759a
--- /dev/null
+++ b/intel_pstate-Fix-intel_pstate_init-error-path.patch
@@ -0,0 +1,76 @@
+From: Dirk Brandewie <dirk.brandewie at gmail.com>
+
+If cpufreq_register_driver() fails just free memory that has been
+allocated and return. intel_pstate_exit() function is removed sine we
+are built-in only now there is no reason for a module exit proceedure.
+
+Reported-by:Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Signed-off-by: Dirk Brandewie <dirk.j.brandewie at intel.com>
+---
+ drivers/cpufreq/intel_pstate.c |   39 +++++++++++----------------------------
+ 1 files changed, 11 insertions(+), 28 deletions(-)
+
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
+index 2bfd083..f6dd1e7 100644
+--- a/drivers/cpufreq/intel_pstate.c
++++ b/drivers/cpufreq/intel_pstate.c
+@@ -750,37 +750,11 @@ static struct cpufreq_driver intel_pstate_driver = {
+ 	.owner		= THIS_MODULE,
+ };
+ 
+-static void intel_pstate_exit(void)
+-{
+-	int cpu;
+-
+-	sysfs_remove_group(intel_pstate_kobject,
+-				&intel_pstate_attr_group);
+-	debugfs_remove_recursive(debugfs_parent);
+-
+-	cpufreq_unregister_driver(&intel_pstate_driver);
+-
+-	if (!all_cpu_data)
+-		return;
+-
+-	get_online_cpus();
+-	for_each_online_cpu(cpu) {
+-		if (all_cpu_data[cpu]) {
+-			del_timer_sync(&all_cpu_data[cpu]->timer);
+-			kfree(all_cpu_data[cpu]);
+-		}
+-	}
+-
+-	put_online_cpus();
+-	vfree(all_cpu_data);
+-}
+-module_exit(intel_pstate_exit);
+-
+ static int __initdata no_load;
+ 
+ static int __init intel_pstate_init(void)
+ {
+-	int rc = 0;
++	int cpu, rc = 0;
+ 	const struct x86_cpu_id *id;
+ 
+ 	if (no_load)
+@@ -805,7 +779,16 @@ static int __init intel_pstate_init(void)
+ 	intel_pstate_sysfs_expose_params();
+ 	return rc;
+ out:
+-	intel_pstate_exit();
++	get_online_cpus();
++	for_each_online_cpu(cpu) {
++		if (all_cpu_data[cpu]) {
++			del_timer_sync(&all_cpu_data[cpu]->timer);
++			kfree(all_cpu_data[cpu]);
++		}
++	}
++
++	put_online_cpus();
++	vfree(all_cpu_data);
+ 	return -ENODEV;
+ }
+ device_initcall(intel_pstate_init);
+-- 
+1.7.7.6
+
diff --git a/kernel.spec b/kernel.spec
index 99fe2f0..5cb4fdb 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -62,7 +62,7 @@ Summary: The Linux kernel
 # For non-released -rc kernels, this will be appended after the rcX and
 # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
 #
-%global baserelease 2
+%global baserelease 3
 %global fedora_build %{baserelease}
 
 # base_sublevel is the kernel version we're starting with and patching
@@ -737,9 +737,10 @@ Patch21262: x86-mm-Fix-vmalloc_fault-oops-during-lazy-MMU-updates.patch
 
 #rhbz 916833
 Patch21263: intel-pstate-do-not-load-on-VM-that-do-not-report-max-P-state.patch
+Patch21264: intel_pstate-Fix-intel_pstate_init-error-path.patch
 
 #rhbz 917984
-Patch21264: efi-fixes.patch
+Patch21265: efi-fixes.patch
 
 Patch22000: weird-root-dentry-name-debug.patch
 
@@ -1436,6 +1437,7 @@ ApplyPatch x86-mm-Fix-vmalloc_fault-oops-during-lazy-MMU-updates.patch
 
 #rhbz 916833
 ApplyPatch intel-pstate-do-not-load-on-VM-that-do-not-report-max-P-state.patch
+ApplyPatch intel_pstate-Fix-intel_pstate_init-error-path.patch
 
 #rhbz 917984
 ApplyPatch efi-fixes.patch
@@ -2281,6 +2283,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Tue Mar 05 2013 Josh Boyer <jwboyer at redhat.com> - 3.9.0-0.rc1.git0.3
+- Fix intel_pstate init error path (rhbz 916833)
+
 * Tue Mar  5 2013 Peter Robinson <pbrobinson at fedoraproject.org>
 - Temporarily disable tegra until we get a fix from upstream
 


More information about the scm-commits mailing list