]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
thermal: Fix potential deadlock in cpu_cooling
authorMatthew Wilcox <mawilcox@microsoft.com>
Fri, 10 Mar 2017 18:33:28 +0000 (18:33 +0000)
committerZhang Rui <rui.zhang@intel.com>
Mon, 13 Mar 2017 02:06:04 +0000 (10:06 +0800)
commit088db931e065bd3b159fa2e588eab859ef0d9d23
tree7211f7bc220cfc430e37dc4fa37dec978efbe0f7
parent4495c08e84729385774601b5146d51d9e5849f81
thermal: Fix potential deadlock in cpu_cooling

cooling_list_lock is covering not just cpufreq_dev_count, but also the
calls to cpufreq_register_notifier() and cpufreq_unregister_notifier().

Since cooling_list_lock is also used within cpufreq_thermal_notifier(),
lockdep reports a potential deadlock. Fix it by testing the condition
under cooling_list_lock and dropping the lock before calling
cpufreq_register_notifier(). And variable cpufreq_dev_count is removed
at the same time, because it's no longer needed after the fix.

Fixes: ae606089621e ("thermal: convert cpu_cooling to use an IDA")
Reported-and-Tested-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/cpu_cooling.c