diff options
author | Richard Cochran <rcochran@linutronix.de> | 2016-04-06 17:00:51 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-07 16:10:54 -0400 |
commit | 51319918bcc31f901646fc66348d41cf74ee0566 (patch) | |
tree | c5dd73b8ab2e6337b7b10d5b76ee66b68dd5d566 /drivers/idle/intel_idle.c | |
parent | 4a3dfb3fc0fb0fc9acd36c94b7145f9c9dd4d93a (diff) |
intel_idle: Fix deallocation order on the driver exit path.
In the module_exit() method, this driver first frees its per-CPU
pointer, then unregisters a callback making use of the pointer.
Furthermore, the function, intel_idle_cpuidle_devices_uninit, is racy
against CPU hot plugging as it calls for_each_online_cpu().
This patch corrects the issues by unregistering first on the exit path
while holding the hot plug lock.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/idle/intel_idle.c')
-rw-r--r-- | drivers/idle/intel_idle.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index cb85c4c42ff9..4a1de3dcbf85 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -1242,16 +1242,16 @@ static int __init intel_idle_init(void) | |||
1242 | 1242 | ||
1243 | static void __exit intel_idle_exit(void) | 1243 | static void __exit intel_idle_exit(void) |
1244 | { | 1244 | { |
1245 | intel_idle_cpuidle_devices_uninit(); | ||
1246 | cpuidle_unregister_driver(&intel_idle_driver); | ||
1247 | |||
1248 | cpu_notifier_register_begin(); | 1245 | cpu_notifier_register_begin(); |
1249 | 1246 | ||
1250 | if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) | 1247 | if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) |
1251 | on_each_cpu(__setup_broadcast_timer, (void *)false, 1); | 1248 | on_each_cpu(__setup_broadcast_timer, (void *)false, 1); |
1252 | __unregister_cpu_notifier(&cpu_hotplug_notifier); | 1249 | __unregister_cpu_notifier(&cpu_hotplug_notifier); |
1250 | intel_idle_cpuidle_devices_uninit(); | ||
1253 | 1251 | ||
1254 | cpu_notifier_register_done(); | 1252 | cpu_notifier_register_done(); |
1253 | |||
1254 | cpuidle_unregister_driver(&intel_idle_driver); | ||
1255 | } | 1255 | } |
1256 | 1256 | ||
1257 | module_init(intel_idle_init); | 1257 | module_init(intel_idle_init); |