Pull power management fixes from Rafael Wysocki: "These fix a regression in the PM-runtime framework introduced by the recent switch-over of it to using hrtimers and a use-after-free introduced by one of the recent changes in the scmi-cpufreq driver. Specifics: - Use hrtimer_try_to_cancel() instead of hrtimer_cancel() in the PM-runtime framework to avoid a possible timer-related deadlock introduced recently (Vincent Guittot). - Reorder the scmi-cpufreq driver code to avoid accessing memory that has just been freed (Yangtao Li)" * tag 'pm-5.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM-runtime: Fix deadlock when canceling hrtimer cpufreq: scmi: Fix use-after-free in scmi_cpufreq_exit()
Unified · Split
| @@ -95,7 +95,7 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status) · 94 unmodified lines | |||
| 95 | static void pm_runtime_deactivate_timer(struct device *dev) | 95 | static void pm_runtime_deactivate_timer(struct device *dev) |
| 96 | { | 96 | { |
| 97 | if (dev->power.timer_expires > 0) { | 97 | if (dev->power.timer_expires > 0) { |
| 98 | hrtimer_cancel(&dev->power.suspend_timer); | 98 | hrtimer_try_to_cancel(&dev->power.suspend_timer); |
| 99 | dev->power.timer_expires = 0; | 99 | dev->power.timer_expires = 0; |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| @@ -187,8 +187,8 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) · 186 unmodified lines | |||
| 187 | 187 | ||
| 188 | cpufreq_cooling_unregister(priv->cdev); | 188 | cpufreq_cooling_unregister(priv->cdev); |
| 189 | dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); | 189 | dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); |
| 190 | kfree(priv); | ||
| 191 | dev_pm_opp_remove_all_dynamic(priv->cpu_dev); | 190 | dev_pm_opp_remove_all_dynamic(priv->cpu_dev); |
| 191 | kfree(priv); | ||
| 192 | 192 | ||
| 193 | return 0; | 193 | return 0; |
| 194 | } | 194 | } |