cpufreq: schedutil: Avoid using invalid next_freq.
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 May 2018 09:44:56 +0000 (11:44 +0200)
committerlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 23 Jul 2018 05:58:20 +0000 (14:58 +0900)
commit28b44d1dd92c5863f0fac41f143decfaa100757f
treeb8badc6c9b88c64e1e1ef3a242b0e06c310b73a0
parentde85a88447fb9009f65c40da9a96aeded0feb898
cpufreq: schedutil: Avoid using invalid next_freq.

commit 97739501f207efe33145b918817f305b822987f8 upstream.

If the next_freq field of struct sugov_policy is set to UINT_MAX,
it shouldn't be used for updating the CPU frequency (this is a
special "invalid" value), but after commit b7eaf1aab9f8 (cpufreq:
schedutil: Avoid reducing frequency of busy CPUs prematurely) it
may be passed as the new frequency to sugov_update_commit() in
sugov_update_single().

Fix that by adding an extra check for the special UINT_MAX value
of next_freq to sugov_update_single().

Change-Id: I516963d8b0fda677e9d82290c0f3d4dc3cb6e477
Fixes: b7eaf1aab9f8 (cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely)
Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.12+ <stable@vger.kernel.org> # 4.12+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/sched/cpufreq_schedutil.c