From b2b45c40882d28c2770f93cb53ed8c145c5925fc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 2 May 2018 09:43:35 -0700 Subject: [PATCH] 4.9-stable patches added patches: perf-core-fix-the-perf_cpu_time_max_percent-check.patch --- ...-the-perf_cpu_time_max_percent-check.patch | 48 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 49 insertions(+) create mode 100644 queue-4.9/perf-core-fix-the-perf_cpu_time_max_percent-check.patch diff --git a/queue-4.9/perf-core-fix-the-perf_cpu_time_max_percent-check.patch b/queue-4.9/perf-core-fix-the-perf_cpu_time_max_percent-check.patch new file mode 100644 index 00000000000..3912234e6e8 --- /dev/null +++ b/queue-4.9/perf-core-fix-the-perf_cpu_time_max_percent-check.patch @@ -0,0 +1,48 @@ +From 1572e45a924f254d9570093abde46430c3172e3d Mon Sep 17 00:00:00 2001 +From: Tan Xiaojun +Date: Thu, 23 Feb 2017 14:04:39 +0800 +Subject: perf/core: Fix the perf_cpu_time_max_percent check + +From: Tan Xiaojun + +commit 1572e45a924f254d9570093abde46430c3172e3d upstream. + +Use "proc_dointvec_minmax" instead of "proc_dointvec" to check the input +value from user-space. + +If not, we can set a big value and some vars will overflow like +"sysctl_perf_event_sample_rate" which will cause a lot of unexpected +problems. + +Signed-off-by: Tan Xiaojun +Signed-off-by: Peter Zijlstra (Intel) +Cc: +Cc: +Cc: Alexander Shishkin +Cc: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Stephane Eranian +Cc: Thomas Gleixner +Cc: Vince Weaver +Link: http://lkml.kernel.org/r/1487829879-56237-1-git-send-email-tanxiaojun@huawei.com +Signed-off-by: Ingo Molnar +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/events/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -453,7 +453,7 @@ int perf_cpu_time_max_percent_handler(st + void __user *buffer, size_t *lenp, + loff_t *ppos) + { +- int ret = proc_dointvec(table, write, buffer, lenp, ppos); ++ int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); + + if (ret || !write) + return ret; diff --git a/queue-4.9/series b/queue-4.9/series index e69de29bb2d..ad4c44ab7a5 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -0,0 +1 @@ +perf-core-fix-the-perf_cpu_time_max_percent-check.patch -- 2.47.3