path: root/kernel
diff options
authorTan Xiaojun <>2017-02-23 14:04:39 +0800
committerIngo Molnar <>2017-02-24 08:56:33 +0100
commit1572e45a924f254d9570093abde46430c3172e3d (patch)
treeda2db02ffa3c27b9d5d8b26c67773c7b4baf6edb /kernel
parent7bbba0eb1af34694868d028b80475981f90e6bee (diff)
perf/core: Fix the perf_cpu_time_max_percent check
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: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'kernel')
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d4e3f8d..c1c1cdf 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -455,7 +455,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
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;